summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/target/mame/arcade.lua2
-rw-r--r--src/devices/cpu/xavix2/xavix2d.cpp2
-rw-r--r--src/lib/formats/sorc_dsk.cpp2
-rw-r--r--src/mame/drivers/amspdwy.cpp244
-rw-r--r--src/mame/drivers/dcebridge.cpp4
-rw-r--r--src/mame/includes/amspdwy.h84
-rw-r--r--src/mame/video/amspdwy.cpp142
-rw-r--r--src/osd/modules/opengl/gl_shader_mgr.cpp14
-rw-r--r--src/osd/modules/sound/sdl_sound.cpp5
-rw-r--r--src/tools/imgtool/imgtool.cpp2
10 files changed, 232 insertions, 269 deletions
diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua
index f4b666c5d09..7029bd54fd4 100644
--- a/scripts/target/mame/arcade.lua
+++ b/scripts/target/mame/arcade.lua
@@ -4785,8 +4785,6 @@ files {
MAME_DIR .. "src/mame/includes/ampoker2.h",
MAME_DIR .. "src/mame/video/ampoker2.cpp",
MAME_DIR .. "src/mame/drivers/amspdwy.cpp",
- MAME_DIR .. "src/mame/includes/amspdwy.h",
- MAME_DIR .. "src/mame/video/amspdwy.cpp",
MAME_DIR .. "src/mame/drivers/amusco.cpp",
MAME_DIR .. "src/mame/drivers/anes.cpp",
MAME_DIR .. "src/mame/drivers/arachnid.cpp",
diff --git a/src/devices/cpu/xavix2/xavix2d.cpp b/src/devices/cpu/xavix2/xavix2d.cpp
index 85132ee6ef2..8b3290a8f6e 100644
--- a/src/devices/cpu/xavix2/xavix2d.cpp
+++ b/src/devices/cpu/xavix2/xavix2d.cpp
@@ -121,7 +121,7 @@ std::string xavix2_disassembler::val3u()
std::string xavix2_disassembler::off19s()
{
- u16 r = m_opcode & 0x7ffff;
+ u32 r = m_opcode & 0x7ffff;
if(r & 0x40000)
return util::string_format(" - %05x", 0x80000 - r);
else if(r)
diff --git a/src/lib/formats/sorc_dsk.cpp b/src/lib/formats/sorc_dsk.cpp
index 2e7b30d2a3d..52e4d5fa8c4 100644
--- a/src/lib/formats/sorc_dsk.cpp
+++ b/src/lib/formats/sorc_dsk.cpp
@@ -31,7 +31,7 @@ static int sorc_get_tracks_per_disk(floppy_image_legacy *floppy)
static uint64_t sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector)
{
- return 270*(16*track+sector);
+ return 270*(16*uint64_t(track+sector));
}
static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, bool sector_is_index, uint64_t *offset)
diff --git a/src/mame/drivers/amspdwy.cpp b/src/mame/drivers/amspdwy.cpp
index 4acfac17ad0..bac1b27a4d2 100644
--- a/src/mame/drivers/amspdwy.cpp
+++ b/src/mame/drivers/amspdwy.cpp
@@ -16,9 +16,213 @@ Sound: YM2151
***************************************************************************/
#include "emu.h"
-#include "includes/amspdwy.h"
+
#include "cpu/z80/z80.h"
+#include "machine/gen_latch.h"
+#include "sound/ymopm.h"
+
+#include "emupal.h"
+#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class amspdwy_state : public driver_device
+{
+public:
+ amspdwy_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram"),
+ m_colorram(*this, "colorram"),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_ym2151(*this, "ymsnd"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette"),
+ m_soundlatch(*this, "soundlatch"),
+ m_io_analog(*this, "AN%u", 1U),
+ m_io_wheel(*this, "WHEEL%u", 1U),
+ m_io_in0(*this, "IN0")
+ { }
+
+ void amspdwy(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+private:
+ /* memory pointers */
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr<uint8_t> m_spriteram;
+ required_shared_ptr<uint8_t> m_colorram;
+
+ /* devices */
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<ym2151_device> m_ym2151;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+ required_device<generic_latch_8_device> m_soundlatch;
+
+ /* I/O ports */
+ required_ioport_array<2> m_io_analog;
+ required_ioport_array<2> m_io_wheel;
+ required_ioport m_io_in0;
+
+ /* video-related */
+ tilemap_t *m_bg_tilemap;
+ int m_flipscreen;
+
+ /* misc */
+ uint16_t m_wheel_old[2];
+ uint8_t m_wheel_return[2];
+
+ void amspdwy_flipscreen_w(uint8_t data);
+ void amspdwy_videoram_w(offs_t offset, uint8_t data);
+ void amspdwy_colorram_w(offs_t offset, uint8_t data);
+ uint8_t amspdwy_sound_r();
+ TILE_GET_INFO_MEMBER(get_tile_info);
+ TILEMAP_MAPPER_MEMBER(tilemap_scan_cols_back);
+
+ uint32_t screen_update_amspdwy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ template <unsigned Index> uint8_t amspdwy_wheel_r();
+
+ void amspdwy_map(address_map &map);
+ void amspdwy_portmap(address_map &map);
+ void amspdwy_sound_map(address_map &map);
+};
+
+
+
+void amspdwy_state::amspdwy_flipscreen_w(uint8_t data)
+{
+ m_flipscreen ^= 1;
+ flip_screen_set(m_flipscreen);
+}
+
+/***************************************************************************
+
+ Callbacks for the TileMap code
+
+ [ Tiles Format ]
+
+ Videoram: 76543210 Code Low Bits
+ Colorram: 765-----
+ ---43--- Code High Bits
+ -----210 Color
+
+***************************************************************************/
+
+TILE_GET_INFO_MEMBER(amspdwy_state::get_tile_info)
+{
+ uint8_t code = m_videoram[tile_index];
+ uint8_t color = m_colorram[tile_index];
+ tileinfo.set(0,
+ code + ((color & 0x18)<<5),
+ color & 0x07,
+ 0);
+}
+
+void amspdwy_state::amspdwy_videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void amspdwy_state::amspdwy_colorram_w(offs_t offset, uint8_t data)
+{
+ m_colorram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+
+/* logical (col,row) -> memory offset */
+TILEMAP_MAPPER_MEMBER(amspdwy_state::tilemap_scan_cols_back)
+{
+ return col * num_rows + (num_rows - row - 1);
+}
+
+
+void amspdwy_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(amspdwy_state::get_tile_info)), tilemap_mapper_delegate(*this, FUNC(amspdwy_state::tilemap_scan_cols_back)), 8, 8, 0x20, 0x20);
+}
+
+
+
+/***************************************************************************
+
+ Sprites Drawing
+
+Offset: Format: Value:
+
+0 Y
+1 X
+2 Code Low Bits
+3 7------- Flip X
+ -6------ Flip Y
+ --5-----
+ ---4---- ?
+ ----3--- Code High Bit?
+ -----210 Color
+
+***************************************************************************/
+
+void amspdwy_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
+{
+ int const max_x = m_screen->width() - 1;
+ int const max_y = m_screen->height() - 1;
+
+ for (int i = 0; i < m_spriteram.bytes(); i += 4)
+ {
+ int y = m_spriteram[i + 0];
+ int x = m_spriteram[i + 1];
+ int const code = m_spriteram[i + 2];
+ int const attr = m_spriteram[i + 3];
+ int flipx = attr & 0x80;
+ int flipy = attr & 0x40;
+
+ if (flip_screen())
+ {
+ x = max_x - x - 8;
+ y = max_y - y - 8;
+ flipx = !flipx;
+ flipy = !flipy;
+ }
+
+ m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
+// code + ((attr & 0x18)<<5),
+ code + ((attr & 0x08)<<5),
+ attr,
+ flipx, flipy,
+ x,y,0 );
+ }
+}
+
+
+
+
+/***************************************************************************
+
+ Screen Drawing
+
+***************************************************************************/
+
+uint32_t amspdwy_state::screen_update_amspdwy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ draw_sprites(bitmap, cliprect);
+ return 0;
+}
+
/***************************************************************************
@@ -37,38 +241,26 @@ Sound: YM2151
Or last value when wheel delta = 0
*/
-uint8_t amspdwy_state::amspdwy_wheel_r( int index )
+template <unsigned Index>
+uint8_t amspdwy_state::amspdwy_wheel_r()
{
- static const char *const portnames[] = { "WHEEL1", "WHEEL2", "AN1", "AN2" };
- uint8_t wheel = ioport(portnames[2 + index])->read();
- if (wheel != m_wheel_old[index])
+ uint16_t wheel = m_io_analog[Index]->read();
+ if (wheel != m_wheel_old[Index])
{
wheel = (wheel & 0x7fff) - (wheel & 0x8000);
- if (wheel > m_wheel_old[index])
- m_wheel_return[index] = ((+wheel) & 0xf) | 0x00;
+ if (wheel > m_wheel_old[Index])
+ m_wheel_return[Index] = ((+wheel) & 0xf) | 0x00;
else
- m_wheel_return[index] = ((-wheel) & 0xf) | 0x10;
+ m_wheel_return[Index] = ((-wheel) & 0xf) | 0x10;
- m_wheel_old[index] = wheel;
+ m_wheel_old[Index] = wheel;
}
- return m_wheel_return[index] | ioport(portnames[index])->read();
-}
-
-uint8_t amspdwy_state::amspdwy_wheel_0_r()
-{
- // player 1
- return amspdwy_wheel_r(0);
-}
-
-uint8_t amspdwy_state::amspdwy_wheel_1_r()
-{
- // player 2
- return amspdwy_wheel_r(1);
+ return m_wheel_return[Index] | m_io_wheel[Index]->read();
}
uint8_t amspdwy_state::amspdwy_sound_r()
{
- return (m_ym2151->status_r() & ~0x30) | ioport("IN0")->read();
+ return (m_ym2151->status_r() & ~0x30) | m_io_in0->read();
}
void amspdwy_state::amspdwy_map(address_map &map)
@@ -81,8 +273,8 @@ void amspdwy_state::amspdwy_map(address_map &map)
// map(0xa000, 0xa000).nopw(); // ?
map(0xa000, 0xa000).portr("DSW1");
map(0xa400, 0xa400).portr("DSW2").w(FUNC(amspdwy_state::amspdwy_flipscreen_w));
- map(0xa800, 0xa800).r(FUNC(amspdwy_state::amspdwy_wheel_0_r));
- map(0xac00, 0xac00).r(FUNC(amspdwy_state::amspdwy_wheel_1_r));
+ map(0xa800, 0xa800).r(FUNC(amspdwy_state::amspdwy_wheel_r<0>)); // player 1
+ map(0xac00, 0xac00).r(FUNC(amspdwy_state::amspdwy_wheel_r<1>)); // player 2
map(0xb000, 0xb000).nopw(); // irq ack?
map(0xb400, 0xb400).r(FUNC(amspdwy_state::amspdwy_sound_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0xc000, 0xc0ff).ram().share("spriteram");
@@ -378,6 +570,8 @@ ROM_START( amspdwya )
ROM_LOAD( "lohi4644.2a", 0x3000, 0x1000, CRC(a1d802b1) SHA1(1249ce406b1aa518885a02ab063fa14906ccec2e) )
ROM_END
+} // anonymous namespace
+
/* (C) 1987 ETI 8402 MAGNOLIA ST. #C SANTEE, CA 92071 */
diff --git a/src/mame/drivers/dcebridge.cpp b/src/mame/drivers/dcebridge.cpp
index d3ce5c77401..46abe3bd36c 100644
--- a/src/mame/drivers/dcebridge.cpp
+++ b/src/mame/drivers/dcebridge.cpp
@@ -181,13 +181,13 @@ template <unsigned N> void dcebridge_state::cts(int state)
ioport_value const conf_local(m_conf[N]->read());
if ((conf_local & DTR_SOURCE_MASK) == DTR_SOURCE_CTS_LOCAL)
m_ports[N]->write_dtr(state);
- if ((conf_local & RTS_SOURCE_MASK) == DTR_SOURCE_CTS_LOCAL)
+ if ((conf_local & RTS_SOURCE_MASK) == RTS_SOURCE_CTS_LOCAL)
m_ports[N]->write_rts(state);
ioport_value const conf_remote(m_conf[N ^ 1U]->read());
if ((conf_remote & DTR_SOURCE_MASK) == DTR_SOURCE_CTS_REMOTE)
m_ports[N ^ 1U]->write_dtr(state);
- if ((conf_remote & RTS_SOURCE_MASK) == DTR_SOURCE_CTS_REMOTE)
+ if ((conf_remote & RTS_SOURCE_MASK) == RTS_SOURCE_CTS_REMOTE)
m_ports[N ^ 1U]->write_rts(state);
}
}
diff --git a/src/mame/includes/amspdwy.h b/src/mame/includes/amspdwy.h
deleted file mode 100644
index 4ee9759dee1..00000000000
--- a/src/mame/includes/amspdwy.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Luca Elia
-/*************************************************************************
-
- American Speedway
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_AMSPDWY_H
-#define MAME_INCLUDES_AMSPDWY_H
-
-#pragma once
-
-#include "machine/gen_latch.h"
-#include "sound/ymopm.h"
-#include "emupal.h"
-#include "screen.h"
-#include "tilemap.h"
-
-class amspdwy_state : public driver_device
-{
-public:
- amspdwy_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram"),
- m_colorram(*this, "colorram"),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_ym2151(*this, "ymsnd"),
- m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen"),
- m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch")
- { }
-
- void amspdwy(machine_config &config);
-
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
-private:
- /* memory pointers */
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_spriteram;
- required_shared_ptr<uint8_t> m_colorram;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<ym2151_device> m_ym2151;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<screen_device> m_screen;
- required_device<palette_device> m_palette;
- required_device<generic_latch_8_device> m_soundlatch;
-
- /* video-related */
- tilemap_t *m_bg_tilemap;
- int m_flipscreen;
-
- /* misc */
- uint8_t m_wheel_old[2];
- uint8_t m_wheel_return[2];
-
- uint8_t amspdwy_wheel_0_r();
- uint8_t amspdwy_wheel_1_r();
- void amspdwy_flipscreen_w(uint8_t data);
- void amspdwy_videoram_w(offs_t offset, uint8_t data);
- void amspdwy_colorram_w(offs_t offset, uint8_t data);
- uint8_t amspdwy_sound_r();
- TILE_GET_INFO_MEMBER(get_tile_info);
- TILEMAP_MAPPER_MEMBER(tilemap_scan_cols_back);
-
- uint32_t screen_update_amspdwy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
- uint8_t amspdwy_wheel_r(int index);
-
- void amspdwy_map(address_map &map);
- void amspdwy_portmap(address_map &map);
- void amspdwy_sound_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_AMSPDWY_H
diff --git a/src/mame/video/amspdwy.cpp b/src/mame/video/amspdwy.cpp
deleted file mode 100644
index 612d3703bd3..00000000000
--- a/src/mame/video/amspdwy.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Luca Elia
-/***************************************************************************
-
- -= American Speedway =-
-
- driver by Luca Elia (l.elia@tin.it)
-
-
-- 8x8 4 Color Tiles (with 8 palettes) used for both:
-
- - 1 256x256 non scrolling layer
- - 64 (32?) Sprites
-
-***************************************************************************/
-
-#include "emu.h"
-#include "includes/amspdwy.h"
-
-
-void amspdwy_state::amspdwy_flipscreen_w(uint8_t data)
-{
- m_flipscreen ^= 1;
- flip_screen_set(m_flipscreen);
-}
-
-/***************************************************************************
-
- Callbacks for the TileMap code
-
- [ Tiles Format ]
-
- Videoram: 76543210 Code Low Bits
- Colorram: 765-----
- ---43--- Code High Bits
- -----210 Color
-
-***************************************************************************/
-
-TILE_GET_INFO_MEMBER(amspdwy_state::get_tile_info)
-{
- uint8_t code = m_videoram[tile_index];
- uint8_t color = m_colorram[tile_index];
- tileinfo.set(0,
- code + ((color & 0x18)<<5),
- color & 0x07,
- 0);
-}
-
-void amspdwy_state::amspdwy_videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void amspdwy_state::amspdwy_colorram_w(offs_t offset, uint8_t data)
-{
- m_colorram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-
-/* logical (col,row) -> memory offset */
-TILEMAP_MAPPER_MEMBER(amspdwy_state::tilemap_scan_cols_back)
-{
- return col * num_rows + (num_rows - row - 1);
-}
-
-
-void amspdwy_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(amspdwy_state::get_tile_info)), tilemap_mapper_delegate(*this, FUNC(amspdwy_state::tilemap_scan_cols_back)), 8, 8, 0x20, 0x20);
-}
-
-
-
-/***************************************************************************
-
- Sprites Drawing
-
-Offset: Format: Value:
-
-0 Y
-1 X
-2 Code Low Bits
-3 7------- Flip X
- -6------ Flip Y
- --5-----
- ---4---- ?
- ----3--- Code High Bit?
- -----210 Color
-
-***************************************************************************/
-
-void amspdwy_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- uint8_t *spriteram = m_spriteram;
- int i;
- int max_x = m_screen->width() - 1;
- int max_y = m_screen->height() - 1;
-
- for (i = 0; i < m_spriteram.bytes() ; i += 4)
- {
- int y = spriteram[i + 0];
- int x = spriteram[i + 1];
- int code = spriteram[i + 2];
- int attr = spriteram[i + 3];
- int flipx = attr & 0x80;
- int flipy = attr & 0x40;
-
- if (flip_screen())
- {
- x = max_x - x - 8;
- y = max_y - y - 8;
- flipx = !flipx;
- flipy = !flipy;
- }
-
- m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
-// code + ((attr & 0x18)<<5),
- code + ((attr & 0x08)<<5),
- attr,
- flipx, flipy,
- x,y,0 );
- }
-}
-
-
-
-
-/***************************************************************************
-
- Screen Drawing
-
-***************************************************************************/
-
-uint32_t amspdwy_state::screen_update_amspdwy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
- return 0;
-}
diff --git a/src/osd/modules/opengl/gl_shader_mgr.cpp b/src/osd/modules/opengl/gl_shader_mgr.cpp
index a4f01bca611..ea09a7fa6a3 100644
--- a/src/osd/modules/opengl/gl_shader_mgr.cpp
+++ b/src/osd/modules/opengl/gl_shader_mgr.cpp
@@ -161,35 +161,33 @@ glsl_shader_info *glsl_shader_init(osd_gl_context *gl_ctx)
#endif
}
if (err) return nullptr;
- return (glsl_shader_info *) malloc(sizeof(glsl_shader_info *));
+ return new glsl_shader_info{ 0 };
}
int glsl_shader_free(glsl_shader_info *shinfo)
{
- int i,j;
-
pfn_glUseProgramObjectARB(0); // back to fixed function pipeline
glFinish();
- for (i=0; i<GLSL_VERTEX_SHADER_MAX_NUMBER+9; i++)
+ for (int i=0; i<GLSL_VERTEX_SHADER_MAX_NUMBER+9; i++)
{
if ( glsl_mamebm_vsh_shader[i] )
(void) gl_delete_shader(nullptr, &glsl_mamebm_vsh_shader[i], nullptr);
}
- for (j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++)
+ for (int j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++)
{
if ( glsl_mamebm_fsh_shader[j] )
(void) gl_delete_shader(nullptr, nullptr, &glsl_mamebm_fsh_shader[j]);
}
- for (j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++)
+ for (int j=0; j<GLSL_SHADER_FEAT_MAX_NUMBER+9; j++)
{
if ( glsl_mamebm_programs[j] )
(void) gl_delete_shader( &glsl_mamebm_programs[j], nullptr, nullptr);
}
- for (i=0; i<10; i++)
+ for (int i=0; i<10; i++)
{
if ( glsl_scrn_vsh_shader[i] )
(void) gl_delete_shader(nullptr, &glsl_scrn_vsh_shader[i], nullptr);
@@ -199,7 +197,7 @@ int glsl_shader_free(glsl_shader_info *shinfo)
(void) gl_delete_shader( &glsl_scrn_programs[i], nullptr, nullptr);
}
- free(shinfo);
+ delete shinfo;
return 0;
}
diff --git a/src/osd/modules/sound/sdl_sound.cpp b/src/osd/modules/sound/sdl_sound.cpp
index 19689541858..86917eeeb07 100644
--- a/src/osd/modules/sound/sdl_sound.cpp
+++ b/src/osd/modules/sound/sdl_sound.cpp
@@ -335,7 +335,6 @@ int sound_sdl::init(const osd_options &options)
int n_channels = 2;
int audio_latency;
SDL_AudioSpec aspec, obtained;
- char audio_driver[16] = "";
if (LOG_SOUND)
sound_log = std::make_unique<std::ofstream>(SDLMAME_SOUND_LOG);
@@ -350,8 +349,8 @@ int sound_sdl::init(const osd_options &options)
}
osd_printf_verbose("Audio: Start initialization\n");
- strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver));
- osd_printf_verbose("Audio: Driver is %s\n", audio_driver);
+ char const *const audio_driver = SDL_GetCurrentAudioDriver();
+ osd_printf_verbose("Audio: Driver is %s\n", audio_driver ? audio_driver : "not initialized");
sdl_xfer_samples = SDL_XFER_SAMPLES;
stream_in_initialized = 0;
diff --git a/src/tools/imgtool/imgtool.cpp b/src/tools/imgtool/imgtool.cpp
index d0c557aac70..ff14b2509cc 100644
--- a/src/tools/imgtool/imgtool.cpp
+++ b/src/tools/imgtool/imgtool.cpp
@@ -2251,7 +2251,7 @@ imgtool::directory::directory(imgtool::partition &partition)
if (partition.m_directory_extra_bytes > 0)
{
m_extra_bytes = std::make_unique<uint8_t[]>(partition.m_directory_extra_bytes);
- memset(m_extra_bytes.get(), 0, sizeof(m_extra_bytes.get()[0] * partition.m_directory_extra_bytes));
+ memset(m_extra_bytes.get(), 0, sizeof(m_extra_bytes[0]) * partition.m_directory_extra_bytes);
}
}