diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/castool.cpp | 31 | ||||
-rw-r--r-- | src/tools/chdman.cpp | 8 | ||||
-rw-r--r-- | src/tools/imgtool/modules/hp85_tape.cpp | 4 | ||||
-rw-r--r-- | src/tools/imgtool/modules/hp9845_tape.cpp | 4 | ||||
-rw-r--r-- | src/tools/ldresample.cpp | 4 | ||||
-rw-r--r-- | src/tools/ldverify.cpp | 14 | ||||
-rw-r--r-- | src/tools/pngcmp.cpp | 44 | ||||
-rw-r--r-- | src/tools/regrep.cpp | 52 | ||||
-rw-r--r-- | src/tools/unidasm.cpp | 2 |
9 files changed, 83 insertions, 80 deletions
diff --git a/src/tools/castool.cpp b/src/tools/castool.cpp index 0b2b4230f8b..e03a15203d5 100644 --- a/src/tools/castool.cpp +++ b/src/tools/castool.cpp @@ -10,15 +10,6 @@ ***************************************************************************/ -#include <cstdio> -#include <cstring> -#include <cctype> -#include <cstdlib> -#include <ctime> -#include <cassert> - -#include "corestr.h" - #include "formats/a26_cas.h" #include "formats/ace_tap.h" #include "formats/adam_cas.h" @@ -61,10 +52,20 @@ #include "formats/x1_tap.h" #include "formats/zx81_p.h" +#include "corestr.h" + +#include <cassert> +#include <cctype> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <ctime> + + struct SupportedCassetteFormats { const char *name; - const struct CassetteFormat * const *formats; + const cassette_image::Format * const *formats; const char *desc; }; @@ -159,8 +160,8 @@ int CLIB_DECL main(int argc, char *argv[]) { int i; int found =0; - const struct CassetteFormat * const *selected_formats = nullptr; - cassette_image *cassette; + const cassette_image::Format * const *selected_formats = nullptr; + cassette_image::ptr cassette; FILE *f; if (argc > 1) @@ -193,14 +194,14 @@ int CLIB_DECL main(int argc, char *argv[]) return -1; } - if (cassette_open_choices(f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, CASSETTE_FLAG_READONLY, &cassette) != cassette_image::error::SUCCESS) { + if (cassette_image::open_choices(f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, cassette_image::FLAG_READONLY, cassette) != cassette_image::error::SUCCESS) { fprintf(stderr, "Invalid format of input file.\n"); fclose(f); return -1; } - cassette_dump(cassette,argv[4]); - cassette_close(cassette); + cassette->dump(argv[4]); + cassette.reset(); fclose(f); goto theend; } diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index 0444bea3da1..06f2373f5ca 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -507,7 +507,7 @@ public: if (m_info.height == 524/2 || m_info.height == 624/2) { vbi_metadata vbi; - vbi_parse_all(&subbitmap.pix16(0), subbitmap.rowpixels(), subbitmap.width(), 8, &vbi); + vbi_parse_all(&subbitmap.pix(0), subbitmap.rowpixels(), subbitmap.width(), 8, &vbi); vbi_metadata_pack(&m_ldframedata[framenum * VBI_PACKED_BYTES], framenum, &vbi); } @@ -2641,9 +2641,11 @@ static void do_extract_ld(parameters_map ¶ms) report_error(1, "Unable to open file (%s)", output_file_str->second->c_str()); // create the codec configuration - avhuff_decompress_config avconfig; + avhuff_decoder::config avconfig; + bitmap_yuy16 avvideo; std::vector<int16_t> audio_data[16]; uint32_t actsamples; + avconfig.video = &avvideo; avconfig.maxsamples = max_samples_per_frame; avconfig.actsamples = &actsamples; for (int chnum = 0; chnum < ARRAY_LENGTH(audio_data); chnum++) @@ -2659,7 +2661,7 @@ static void do_extract_ld(parameters_map ¶ms) progress(framenum == input_start, "Extracting, %.1f%% complete... \r", 100.0 * double(framenum - input_start) / double(input_end - input_start)); // set up the fake bitmap for this frame - avconfig.video.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); + avvideo.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); input_chd.codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig); // read the hunk into the buffers diff --git a/src/tools/imgtool/modules/hp85_tape.cpp b/src/tools/imgtool/modules/hp85_tape.cpp index dada87e290a..fbdef06a7cb 100644 --- a/src/tools/imgtool/modules/hp85_tape.cpp +++ b/src/tools/imgtool/modules/hp85_tape.cpp @@ -866,7 +866,7 @@ namespace { tape_image_85& get_tape_image(tape_state_t& ts) { if (ts.img == nullptr) { - ts.img = global_alloc(tape_image_85); + ts.img = new tape_image_85; } return *(ts.img); @@ -916,7 +916,7 @@ namespace { delete state.stream; // Free tape_image - global_free(&tape_image); + delete &tape_image; } imgtoolerr_t hp85_tape_begin_enum (imgtool::directory &enumeration, const char *path) diff --git a/src/tools/imgtool/modules/hp9845_tape.cpp b/src/tools/imgtool/modules/hp9845_tape.cpp index d3416deaefd..e9abc99789c 100644 --- a/src/tools/imgtool/modules/hp9845_tape.cpp +++ b/src/tools/imgtool/modules/hp9845_tape.cpp @@ -985,7 +985,7 @@ static tape_state_t& get_tape_state(imgtool::image &img) static tape_image_t& get_tape_image(tape_state_t& ts) { if (ts.img == nullptr) { - ts.img = global_alloc(tape_image_t); + ts.img = new tape_image_t; } return *(ts.img); @@ -1034,7 +1034,7 @@ static void hp9845_tape_close(imgtool::image &image) delete state.stream; // Free tape_image - global_free(&tape_image); + delete &tape_image; } static imgtoolerr_t hp9845_tape_begin_enum (imgtool::directory &enumeration, const char *path) diff --git a/src/tools/ldresample.cpp b/src/tools/ldresample.cpp index 57c20f7777c..a7dd165c2f9 100644 --- a/src/tools/ldresample.cpp +++ b/src/tools/ldresample.cpp @@ -237,8 +237,8 @@ static chd_error create_chd(chd_file_compressor &file, const char *filename, chd static bool read_chd(chd_file &file, uint32_t field, movie_info &info, uint32_t soundoffs) { // configure the codec - avhuff_decompress_config avconfig; - avconfig.video.wrap(info.bitmap, info.bitmap.cliprect()); + avhuff_decoder::config avconfig; + avconfig.video = &info.bitmap; avconfig.maxsamples = info.lsound.size(); avconfig.actsamples = &info.samples; avconfig.audio[0] = &info.lsound[soundoffs]; diff --git a/src/tools/ldverify.cpp b/src/tools/ldverify.cpp index deee9afba36..e8df214734c 100644 --- a/src/tools/ldverify.cpp +++ b/src/tools/ldverify.cpp @@ -235,8 +235,10 @@ static int read_chd(void *file, int frame, bitmap_yuy16 &bitmap, int16_t *lsound for (int fieldnum = 0; fieldnum < interlace_factor; fieldnum++) { // make a fake bitmap for this field - avhuff_decompress_config avconfig; - avconfig.video.wrap(&bitmap.pix16(fieldnum), bitmap.width(), bitmap.height() / interlace_factor, bitmap.rowpixels() * interlace_factor); + bitmap_yuy16 video; + video.wrap(&bitmap.pix(fieldnum), bitmap.width(), bitmap.height() / interlace_factor, bitmap.rowpixels() * interlace_factor); + avhuff_decoder::config avconfig; + avconfig.video = &video; // configure the codec uint32_t numsamples; @@ -320,7 +322,7 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap) // parse the VBI data vbi_metadata metadata; - vbi_parse_all(&bitmap.pix16(fieldnum), bitmap.rowpixels() * 2, bitmap.width(), 8, &metadata); + vbi_parse_all(&bitmap.pix(fieldnum), bitmap.rowpixels() * 2, bitmap.width(), 8, &metadata); // if we have data in both 17 and 18, it should match if (metadata.line17 != 0 && metadata.line18 != 0 && metadata.line17 != metadata.line18) @@ -484,11 +486,11 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap) { for (int x = 16; x < 720 - 16; x++) { - yhisto[bitmap.pix16(y, x) >> 8]++; + yhisto[bitmap.pix(y, x) >> 8]++; if (x % 2 == 0) - cbhisto[bitmap.pix16(y, x) & 0xff]++; + cbhisto[bitmap.pix(y, x) & 0xff]++; else - crhisto[bitmap.pix16(y, x) & 0xff]++; + crhisto[bitmap.pix(y, x) & 0xff]++; } pixels += 720 - 16 - 16; } diff --git a/src/tools/pngcmp.cpp b/src/tools/pngcmp.cpp index eb56d4a7ee7..714700a3824 100644 --- a/src/tools/pngcmp.cpp +++ b/src/tools/pngcmp.cpp @@ -74,10 +74,8 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img int width, height, maxwidth; util::core_file::ptr file; osd_file::error filerr; - png_error pngerr; + util::png_error pngerr; int error = 100; - bool bitmaps_differ; - int x, y; /* open the source image */ filerr = util::core_file::open(imgfile1, OPEN_FLAG_READ, file); @@ -88,11 +86,11 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img } /* load the source image */ - pngerr = png_read_bitmap(*file, bitmap1); + pngerr = util::png_read_bitmap(*file, bitmap1); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) { - printf("Could not read %s (%d)\n", imgfile1.c_str(), pngerr); + printf("Could not read %s (%d)\n", imgfile1.c_str(), int(pngerr)); goto error; } @@ -105,24 +103,26 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img } /* load the source image */ - pngerr = png_read_bitmap(*file, bitmap2); + pngerr = util::png_read_bitmap(*file, bitmap2); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) { - printf("Could not read %s (%d)\n", imgfile2.c_str(), pngerr); + printf("Could not read %s (%d)\n", imgfile2.c_str(), int(pngerr)); goto error; } /* if the sizes are different, we differ; otherwise start off assuming we are the same */ + bool bitmaps_differ; bitmaps_differ = (bitmap2.width() != bitmap1.width() || bitmap2.height() != bitmap1.height()); /* compare scanline by scanline */ - for (y = 0; y < bitmap2.height() && !bitmaps_differ; y++) + for (int y = 0; y < bitmap2.height() && !bitmaps_differ; y++) { - uint32_t *base = &bitmap1.pix32(y); - uint32_t *curr = &bitmap2.pix32(y); + uint32_t const *base = &bitmap1.pix(y); + uint32_t const *curr = &bitmap2.pix(y); /* scan the scanline */ + int x; for (x = 0; x < bitmap2.width(); x++) if (*base++ != *curr++) break; @@ -148,16 +148,16 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img /* now copy and compare each set of bitmaps */ int curheight = std::max(bitmap1.height(), bitmap2.height()); /* iterate over rows in these bitmaps */ - for (y = 0; y < curheight; y++) + for (int y = 0; y < curheight; y++) { - uint32_t *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; - uint32_t *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; - uint32_t *dst1 = &finalbitmap.pix32(y); - uint32_t *dst2 = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE); - uint32_t *dstdiff = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); + uint32_t const *src1 = (y < bitmap1.height()) ? &bitmap1.pix(y) : nullptr; + uint32_t const *src2 = (y < bitmap2.height()) ? &bitmap2.pix(y) : nullptr; + uint32_t *dst1 = &finalbitmap.pix(y); + uint32_t *dst2 = &finalbitmap.pix(y, bitmap1.width() + BITMAP_SPACE); + uint32_t *dstdiff = &finalbitmap.pix(y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); /* now iterate over columns */ - for (x = 0; x < maxwidth; x++) + for (int x = 0; x < maxwidth; x++) { int pix1 = -1, pix2 = -2; @@ -176,11 +176,11 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img printf("Could not open %s (%d)\n", outfilename.c_str(), int(filerr)); goto error; } - pngerr = png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr); + pngerr = util::png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) { - printf("Could not write %s (%d)\n", outfilename.c_str(), pngerr); + printf("Could not write %s (%d)\n", outfilename.c_str(), int(pngerr)); goto error; } } diff --git a/src/tools/regrep.cpp b/src/tools/regrep.cpp index f45351272a7..49637c2eb16 100644 --- a/src/tools/regrep.cpp +++ b/src/tools/regrep.cpp @@ -607,7 +607,6 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st summary_file *buckethead[BUCKET_COUNT], **buckettailptr[BUCKET_COUNT]; summary_file *curfile; std::string title("MAME Regressions"); - std::string tempname; int listnum, bucknum; util::core_file::ptr indexfile; int count = 0, total; @@ -686,7 +685,7 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st *buckettailptr[bucknum] = nullptr; /* output header */ - tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); + std::string tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); indexfile = create_file_and_output_header(tempname, tempheader, title); if (!indexfile) { @@ -721,10 +720,9 @@ static int compare_screenshots(summary_file *curfile) bitmap_argb32 bitmaps[MAX_COMPARES]; int unique[MAX_COMPARES]; int numunique = 0; - int listnum; /* iterate over all files and load their bitmaps */ - for (listnum = 0; listnum < list_count; listnum++) + for (int listnum = 0; listnum < list_count; listnum++) if (curfile->status[listnum] == STATUS_SUCCESS) { std::string fullname; @@ -750,12 +748,13 @@ static int compare_screenshots(summary_file *curfile) /* if that worked, load the file */ if (filerr == osd_file::error::NONE) { - png_read_bitmap(*file, bitmaps[listnum]); + util::png_read_bitmap(*file, bitmaps[listnum]); file.reset(); } } /* now find all the different bitmap types */ + int listnum; for (listnum = 0; listnum < list_count; listnum++) { curfile->matchbitmap[listnum] = 0xff; @@ -774,8 +773,8 @@ static int compare_screenshots(summary_file *curfile) /* compare scanline by scanline */ for (int y = 0; y < this_bitmap.height() && !bitmaps_differ; y++) { - uint32_t *base = &base_bitmap.pix32(y); - uint32_t *curr = &this_bitmap.pix32(y); + uint32_t const *base = &base_bitmap.pix(y); + uint32_t const *curr = &this_bitmap.pix(y); /* scan the scanline */ int x; @@ -831,14 +830,12 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, bitmap_argb32 bitmaps[MAX_COMPARES]; std::string srcimgname; std::string dstfilename; - std::string tempname; bitmap_argb32 finalbitmap; int width, height, maxwidth; int bitmapcount = 0; - int listnum, bmnum; util::core_file::ptr file; osd_file::error filerr; - png_error pngerr; + util::png_error pngerr; int error = -1; int starty; @@ -847,10 +844,10 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, srcimgname = string_format("snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name); /* open and load all unique bitmaps */ - for (listnum = 0; listnum < list_count; listnum++) + for (int listnum = 0; listnum < list_count; listnum++) if (curfile->matchbitmap[listnum] == listnum) { - tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); + std::string tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); /* open the source image */ filerr = util::core_file::open(tempname, OPEN_FLAG_READ, file); @@ -858,9 +855,9 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, goto error; /* load the source image */ - pngerr = png_read_bitmap(*file, bitmaps[bitmapcount++]); + pngerr = util::png_read_bitmap(*file, bitmaps[bitmapcount++]); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) goto error; } @@ -871,7 +868,7 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, /* determine the size of the final bitmap */ height = width = 0; maxwidth = bitmaps[0].width(); - for (bmnum = 1; bmnum < bitmapcount; bmnum++) + for (int bmnum = 1; bmnum < bitmapcount; bmnum++) { int curwidth; @@ -891,24 +888,23 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, /* now copy and compare each set of bitmaps */ starty = 0; - for (bmnum = 1; bmnum < bitmapcount; bmnum++) + for (int bmnum = 1; bmnum < bitmapcount; bmnum++) { - bitmap_argb32 &bitmap1 = bitmaps[0]; - bitmap_argb32 &bitmap2 = bitmaps[bmnum]; + bitmap_argb32 const &bitmap1 = bitmaps[0]; + bitmap_argb32 const &bitmap2 = bitmaps[bmnum]; int curheight = std::max(bitmap1.height(), bitmap2.height()); - int x, y; /* iterate over rows in these bitmaps */ - for (y = 0; y < curheight; y++) + for (int y = 0; y < curheight; y++) { - uint32_t *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; - uint32_t *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; - uint32_t *dst1 = &finalbitmap.pix32(starty + y, 0); - uint32_t *dst2 = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE); - uint32_t *dstdiff = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); + uint32_t const *src1 = (y < bitmap1.height()) ? &bitmap1.pix(y) : nullptr; + uint32_t const *src2 = (y < bitmap2.height()) ? &bitmap2.pix(y) : nullptr; + uint32_t *dst1 = &finalbitmap.pix(starty + y, 0); + uint32_t *dst2 = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE); + uint32_t *dstdiff = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); /* now iterate over columns */ - for (x = 0; x < maxwidth; x++) + for (int x = 0; x < maxwidth; x++) { int pix1 = -1, pix2 = -2; @@ -928,9 +924,9 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, filerr = util::core_file::open(dstfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, file); if (filerr != osd_file::error::NONE) goto error; - pngerr = png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr); + pngerr = util::png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) goto error; /* if we get here, we are error free */ diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp index b5a175c1d96..a7cae6968c0 100644 --- a/src/tools/unidasm.cpp +++ b/src/tools/unidasm.cpp @@ -73,6 +73,7 @@ using util::BIT; #include "cpu/ie15/ie15dasm.h" #include "cpu/jaguar/jagdasm.h" #include "cpu/ks0164/ks0164d.h" +#include "cpu/lc58/lc58d.h" #include "cpu/lc8670/lc8670dsm.h" #include "cpu/lh5801/5801dasm.h" #include "cpu/lr35902/lr35902d.h" @@ -434,6 +435,7 @@ static const dasm_table_entry dasm_table[] = { "jaguargpu", be, 0, []() -> util::disasm_interface * { return new jaguar_disassembler(jaguar_disassembler::variant::GPU); } }, { "konami", be, 0, []() -> util::disasm_interface * { return new konami_disassembler; } }, { "ks0164", be, 0, []() -> util::disasm_interface * { return new ks0164_disassembler; } }, + { "lc58", be, -1, []() -> util::disasm_interface * { return new lc58_disassembler; } }, { "lc8670", be, 0, []() -> util::disasm_interface * { return new lc8670_disassembler; } }, { "lh5801", le, 0, []() -> util::disasm_interface * { return new lh5801_disassembler; } }, { "lr35902", le, 0, []() -> util::disasm_interface * { return new lr35902_disassembler; } }, |