From a4a2b6e3cfaa1550571101cfe50c94e97c4b90f4 Mon Sep 17 00:00:00 2001 From: Steven Coomber <81829553+scoomby@users.noreply.github.com> Date: Sun, 27 Jun 2021 19:39:16 +0100 Subject: [PATCH 1/6] chanbara.cpp: swapped left and right joysticks (MT# 08015) (#8233) --- src/mame/drivers/chanbara.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/mame/drivers/chanbara.cpp b/src/mame/drivers/chanbara.cpp index c93140c904a..c4f7adc8c53 100644 --- a/src/mame/drivers/chanbara.cpp +++ b/src/mame/drivers/chanbara.cpp @@ -291,24 +291,24 @@ static INPUT_PORTS_START( chanbara ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_START ("P1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_4WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_4WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_4WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_4WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_4WAY + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_4WAY PORT_START ("P2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_COCKTAIL - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_COCKTAIL - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_COCKTAIL - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_COCKTAIL - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_COCKTAIL - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_COCKTAIL + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_4WAY PORT_COCKTAIL INPUT_PORTS_END /***************************************************************************/ From 8c12c611817cbade57ca6ab5235436a6e766ea34 Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Sun, 27 Jun 2021 17:23:39 -0400 Subject: [PATCH 2/6] - Re-added unique input for bigtwinb and fixes MT#8016 --- src/mame/drivers/playmark.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mame/drivers/playmark.cpp b/src/mame/drivers/playmark.cpp index cc7ddf29668..d39c19e7ce3 100644 --- a/src/mame/drivers/playmark.cpp +++ b/src/mame/drivers/playmark.cpp @@ -555,6 +555,18 @@ static INPUT_PORTS_START( bigtwinb ) PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:3") // No nudes, No Censor dipswitch PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_MODIFY("P1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + + PORT_MODIFY("P2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) INPUT_PORTS_END static INPUT_PORTS_START( wbeachvl ) From 18737febb5c76d38a464dfdb760f6f2a6a32af14 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 29 Jun 2021 02:54:16 +1000 Subject: [PATCH 3/6] emu/rendutil.cpp: Use setjmp/longjmp for libjpeg error unwinding. Apparently Linux AArch64 has issues with throwing exceptions across C function frames. --- src/emu/rendutil.cpp | 162 ++++++++++++++++++++++++------------------- 1 file changed, 91 insertions(+), 71 deletions(-) diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp index 443887b6305..a902a51bd85 100644 --- a/src/emu/rendutil.cpp +++ b/src/emu/rendutil.cpp @@ -17,6 +17,9 @@ #include "jpeglib.h" #include "jerror.h" +#include +#include + namespace { @@ -113,6 +116,18 @@ void jpeg_corefile_source::source(j_decompress_ptr cinfo, util::core_file &file) src->next_input_byte = nullptr; } + +struct jpeg_setjmp_error_mgr : public jpeg_error_mgr +{ + jpeg_setjmp_error_mgr() + { + jpeg_std_error(this); + error_exit = [] (j_common_ptr cinfo) { std::longjmp(static_cast(cinfo->err)->m_jump_buffer, 1); }; + } + + std::jmp_buf m_jump_buffer; +}; + } // anonymous namespace @@ -672,73 +687,74 @@ void render_load_jpeg(bitmap_argb32 &bitmap, util::core_file &file) // deallocate previous bitmap bitmap.reset(); - // create a JPEG source for the file + // set up context for error handling jpeg_decompress_struct cinfo; - jpeg_error_mgr jerr; - cinfo.err = jpeg_std_error(&jerr); - jerr.error_exit = [] (j_common_ptr cinfo) { throw cinfo->err; }; + jpeg_setjmp_error_mgr jerr; + cinfo.err = &jerr; JSAMPARRAY buffer = nullptr; - try - { - jpeg_create_decompress(&cinfo); - cinfo.mem->max_memory_to_use = 128 * 1024 * 1024; - jpeg_corefile_source::source(&cinfo, file); - - // read JPEG header and start decompression - jpeg_read_header(&cinfo, TRUE); - jpeg_start_decompress(&cinfo); - - // allocates the destination bitmap - int w = cinfo.output_width; - int h = cinfo.output_height; - int s = cinfo.output_components; - bitmap.allocate(w, h); - - // allocates a buffer to receive the information and copy them into the bitmap - int row_stride = cinfo.output_width * cinfo.output_components; - JSAMPARRAY buffer = reinterpret_cast(malloc(sizeof(JSAMPROW))); - buffer[0] = reinterpret_cast(malloc(sizeof(JSAMPLE) * row_stride)); - - while (cinfo.output_scanline < cinfo.output_height) - { - int j = cinfo.output_scanline; - jpeg_read_scanlines(&cinfo, buffer, 1); - - if (s == 1) - { - for (int i = 0; i < w; ++i) - bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); - - } - else if (s == 3) - { - for (int i = 0; i < w; ++i) - bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); - } - else - { - osd_printf_error("Cannot read JPEG data from file.\n"); - bitmap.reset(); - break; - } - } - - // finish decompression and frees the memory - jpeg_finish_decompress(&cinfo); - } - catch (jpeg_error_mgr *) + int w, h, s, row_stride, j, i; + if (setjmp(jerr.m_jump_buffer)) // setjmp must be used in control expression { char msg[1024]; (cinfo.err->format_message)(reinterpret_cast(&cinfo), msg); osd_printf_error("JPEG error reading data from file: %s\n", msg); bitmap.reset(); + goto cleanup; // use goto to ensure longjmp can't cross an initialisation } + + // create a JPEG source for the file + jpeg_create_decompress(&cinfo); + cinfo.mem->max_memory_to_use = 128 * 1024 * 1024; + jpeg_corefile_source::source(&cinfo, file); + + // read JPEG header and start decompression + jpeg_read_header(&cinfo, TRUE); + jpeg_start_decompress(&cinfo); + + // allocates the destination bitmap + w = cinfo.output_width; + h = cinfo.output_height; + s = cinfo.output_components; + bitmap.allocate(w, h); + + // allocates a buffer to receive the information and copy them into the bitmap + row_stride = cinfo.output_width * cinfo.output_components; + buffer = reinterpret_cast(std::malloc(sizeof(JSAMPROW))); + buffer[0] = reinterpret_cast(std::malloc(sizeof(JSAMPLE) * row_stride)); + + while (cinfo.output_scanline < cinfo.output_height) + { + j = cinfo.output_scanline; + jpeg_read_scanlines(&cinfo, buffer, 1); + + if (s == 1) + { + for (i = 0; i < w; ++i) + bitmap.pix(j, i) = rgb_t(0xff, buffer[0][i], buffer[0][i], buffer[0][i]); + + } + else if (s == 3) + { + for (i = 0; i < w; ++i) + bitmap.pix(j, i) = rgb_t(0xff, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); + } + else + { + osd_printf_error("Cannot read JPEG data from file.\n"); + bitmap.reset(); + break; + } + } + + // finish decompression and free the memory + jpeg_finish_decompress(&cinfo); +cleanup: jpeg_destroy_decompress(&cinfo); if (buffer) { if (buffer[0]) - free(buffer[0]); - free(buffer); + std::free(buffer[0]); + std::free(buffer); } } @@ -917,18 +933,21 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const util::png_info ru_imgformat render_detect_image(util::core_file &file) { // PNG: check for valid header - util::png_error const png = util::png_info::verify_header(file); - file.seek(0, SEEK_SET); - if (util::png_error::NONE == png) - return RENDUTIL_IMGFORMAT_PNG; + { + util::png_error const png = util::png_info::verify_header(file); + file.seek(0, SEEK_SET); + if (util::png_error::NONE == png) + return RENDUTIL_IMGFORMAT_PNG; + } // JPEG: attempt to read header with libjpeg - jpeg_decompress_struct cinfo; - jpeg_error_mgr jerr; - cinfo.err = jpeg_std_error(&jerr); - jerr.error_exit = [] (j_common_ptr cinfo) { throw cinfo->err; }; - try { + jpeg_decompress_struct cinfo; + jpeg_setjmp_error_mgr jerr; + cinfo.err = &jerr; + if (setjmp(jerr.m_jump_buffer)) // setjmp must be used in control expression + goto notjpeg; // use goto to ensure longjmp can't cross an initialisation + jpeg_create_decompress(&cinfo); cinfo.mem->max_memory_to_use = 128 * 1024 * 1024; jpeg_corefile_source::source(&cinfo, file); @@ -936,18 +955,19 @@ ru_imgformat render_detect_image(util::core_file &file) jpeg_destroy_decompress(&cinfo); file.seek(0, SEEK_SET); return RENDUTIL_IMGFORMAT_JPEG; - } - catch (jpeg_error_mgr *) - { + + notjpeg: jpeg_destroy_decompress(&cinfo); file.seek(0, SEEK_SET); } // Microsoft DIB: check for valid header - util::msdib_error const msdib = util::msdib_verify_header(file); - file.seek(0, SEEK_SET); - if (util::msdib_error::NONE == msdib) - return RENDUTIL_IMGFORMAT_MSDIB; + { + util::msdib_error const msdib = util::msdib_verify_header(file); + file.seek(0, SEEK_SET); + if (util::msdib_error::NONE == msdib) + return RENDUTIL_IMGFORMAT_MSDIB; + } // TODO: add more as necessary return RENDUTIL_IMGFORMAT_UNKNOWN; From c9fc85d96d7c98ca69269c7b741b459689aadf58 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 30 Jun 2021 22:21:23 +1000 Subject: [PATCH 4/6] Clean up some software list metadata --- hash/ibm5150.xml | 2 +- hash/ibm5170.xml | 4 ++-- hash/spectrum_cass.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hash/ibm5150.xml b/hash/ibm5150.xml index 1d0fb8ac5f5..ba4b079b8bd 100644 --- a/hash/ibm5150.xml +++ b/hash/ibm5150.xml @@ -5180,7 +5180,7 @@ Known PC Booter Games Not Dumped, Or Dumped and Lost when Demonlord's Site went - FreeDOS 1.3 Release Candidate 4 (Floppy-Only Edition, 3.5" 720k) + FreeDOS 1.3 Release Candidate 4 (Floppy-Only Edition, 3.5" 720k) 2021 The FreeDOS Project diff --git a/hash/ibm5170.xml b/hash/ibm5170.xml index 93c24933d7b..3096efa589f 100644 --- a/hash/ibm5170.xml +++ b/hash/ibm5170.xml @@ -688,7 +688,7 @@ license:CC0 - FreeDOS 1.3 Release Candidate 4 (Floppy-Only Edition, 5.25" 1.2mb) + FreeDOS 1.3 Release Candidate 4 (Floppy-Only Edition, 5.25" 1.2MB) 2021 The FreeDOS Project @@ -755,7 +755,7 @@ license:CC0 - FreeDOS 1.3 Release Candidate 4 (Floppy-Only Edition, 3.5" 1.44m) + FreeDOS 1.3 Release Candidate 4 (Floppy-Only Edition, 3.5" 1.44MB) 2021 The FreeDOS Project diff --git a/hash/spectrum_cass.xml b/hash/spectrum_cass.xml index db04dd81fbb..7b5c9cf9728 100644 --- a/hash/spectrum_cass.xml +++ b/hash/spectrum_cass.xml @@ -137183,7 +137183,7 @@ license:CC0 - Uchi-Mata (IBSA/Erbe, serie leyenda) + Uchi-Mata (IBSA/Erbe, Serie Leyenda) 1988 IBSA/Erbe Software From e1ceb9f3e88b02ff6da3003f9e5f94ea2771b5e4 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 30 Jun 2021 22:45:06 +1000 Subject: [PATCH 5/6] Add pofo_kbd.h to build scripts so it's picked up when generating IDE projects. --- scripts/target/mame/mess.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 15e31fd7400..882141e8718 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -1899,6 +1899,7 @@ files { MAME_DIR .. "src/mame/machine/lynx.cpp", MAME_DIR .. "src/mame/drivers/pofo.cpp", MAME_DIR .. "src/mame/machine/pofo_kbd.cpp", + MAME_DIR .. "src/mame/machine/pofo_kbd.h", MAME_DIR .. "src/mame/drivers/tvboy.cpp", } From 05d0cf61e7f929d1b3b5582b500648c4253dac60 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 30 Jun 2021 23:39:06 +1000 Subject: [PATCH 6/6] Bump version to 0.233 --- android-project/app/src/main/AndroidManifest.xml | 4 ++-- makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android-project/app/src/main/AndroidManifest.xml b/android-project/app/src/main/AndroidManifest.xml index 999ea605d6b..5978b0b0cbb 100644 --- a/android-project/app/src/main/AndroidManifest.xml +++ b/android-project/app/src/main/AndroidManifest.xml @@ -4,8 +4,8 @@ --> diff --git a/makefile b/makefile index 7738b07fa57..1bdbcac7938 100644 --- a/makefile +++ b/makefile @@ -1760,14 +1760,14 @@ endif ifeq (posix,$(SHELLTYPE)) $(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS) - @echo '#define BARE_BUILD_VERSION "0.232"' > $@ + @echo '#define BARE_BUILD_VERSION "0.233"' > $@ @echo 'extern const char bare_build_version[];' >> $@ @echo 'extern const char build_version[];' >> $@ @echo 'const char bare_build_version[] = BARE_BUILD_VERSION;' >> $@ @echo 'const char build_version[] = BARE_BUILD_VERSION " ($(NEW_GIT_VERSION))";' >> $@ else $(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS) - @echo #define BARE_BUILD_VERSION "0.232" > $@ + @echo #define BARE_BUILD_VERSION "0.233" > $@ @echo extern const char bare_build_version[]; >> $@ @echo extern const char build_version[]; >> $@ @echo const char bare_build_version[] = BARE_BUILD_VERSION; >> $@