From 2c40cf660e2c69e6856d182fed1ce15338f45b91 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 7 Mar 2024 03:10:27 +1100 Subject: [PATCH] -input/input_rawinput.cpp: Properly align buffers for RAWINPUT header -jaleco/megasys1.cpp: Clarified comment about MCU program used for chimerab. --- src/mame/jaleco/megasys1.cpp | 2 +- src/osd/modules/input/input_rawinput.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mame/jaleco/megasys1.cpp b/src/mame/jaleco/megasys1.cpp index 8a950aa0e5e..0fac0919a2e 100644 --- a/src/mame/jaleco/megasys1.cpp +++ b/src/mame/jaleco/megasys1.cpp @@ -2923,7 +2923,7 @@ ROM_START( chimerab ) ROM_LOAD16_BYTE( "prg8.bin", 0x000000, 0x010000, CRC(a682b1ca) SHA1(66f5d5a73f5e8cba87eac09c55eee59117d94f7b) ) ROM_LOAD16_BYTE( "prg7.bin", 0x000001, 0x010000, CRC(83b9982d) SHA1(68e7d344ebfffe19822c4cf9f7b13cb51f23537a) ) - ROM_REGION( 0x4000, "iomcu", 0 ) /* TMP91640 Internal Code, same as cybattlr */ + ROM_REGION( 0x4000, "iomcu", 0 ) /* TMP91640 Internal Code - using Cybattler program, label not confirmed */ ROM_LOAD( "mo-91028.mcu", 0x00000, 0x04000, BAD_DUMP CRC(a72e04a7) SHA1(0bd96272e37b0e23793ca47b98a966540e2e2df9) ) ROM_REGION( 0x080000, "scroll0", 0 ) /* Scroll 0 */ diff --git a/src/osd/modules/input/input_rawinput.cpp b/src/osd/modules/input/input_rawinput.cpp index 3b5491fd09d..d6b99649c4a 100644 --- a/src/osd/modules/input/input_rawinput.cpp +++ b/src/osd/modules/input/input_rawinput.cpp @@ -608,7 +608,7 @@ private: //============================================================ -// rawinput_module - base class for rawinput modules +// rawinput_module - base class for RawInput modules //============================================================ class rawinput_module : public wininput_module @@ -726,9 +726,9 @@ protected: { HRAWINPUT const rawinputdevice = *static_cast(eventdata); - BYTE small_buffer[4096]; + union { RAWINPUT r; BYTE b[4096]; } small_buffer; std::unique_ptr larger_buffer; - LPBYTE data = small_buffer; + LPVOID data = &small_buffer; UINT size; // determine the size of data buffer we need @@ -738,7 +738,7 @@ protected: // if necessary, allocate a temporary buffer and fetch the data if (size > sizeof(small_buffer)) { - larger_buffer.reset(new (std::nothrow) BYTE [size]); + larger_buffer.reset(new (std::align_val_t(alignof(RAWINPUT)), std::nothrow) BYTE [size]); data = larger_buffer.get(); if (!data) return false; @@ -843,7 +843,7 @@ protected: //============================================================ -// keyboard_input_rawinput - rawinput keyboard module +// keyboard_input_rawinput - RawInput keyboard module //============================================================ class keyboard_input_rawinput : public rawinput_module @@ -870,7 +870,7 @@ protected: //============================================================ -// mouse_input_rawinput - rawinput mouse module +// mouse_input_rawinput - RawInput mouse module //============================================================ class mouse_input_rawinput : public rawinput_module @@ -897,7 +897,7 @@ protected: //============================================================ -// lightgun_input_rawinput - rawinput lightgun module +// lightgun_input_rawinput - RawInput lightgun module //============================================================ class lightgun_input_rawinput : public rawinput_module