From 33eabc4b3dc823c01305a3fbc1126b4d3f896dac Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 24 May 2026 05:09:42 +1000 Subject: [PATCH] handheld/unknown_bftetris_lcdc.cpp: 256KiB is too heavy for a device class. --- .../machine/generalplus_gpl162xx_soc.cpp | 16 +++++++-------- .../machine/generalplus_gpl951xx_soc.cpp | 20 +++++++++---------- .../machine/generalplus_gpl_timebase.cpp | 14 +++++++------ .../machine/generalplus_gpl_timebase.h | 10 +++++----- src/mame/handheld/generalplus_gpl951xx.cpp | 7 ++++--- src/mame/handheld/unknown_bftetris_lcdc.cpp | 4 ++-- src/mame/handheld/unknown_bftetris_lcdc.h | 7 +++++-- 7 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/devices/machine/generalplus_gpl162xx_soc.cpp b/src/devices/machine/generalplus_gpl162xx_soc.cpp index 9ddda8f84..d181d8d46 100644 --- a/src/devices/machine/generalplus_gpl162xx_soc.cpp +++ b/src/devices/machine/generalplus_gpl162xx_soc.cpp @@ -231,7 +231,7 @@ void sunplus_gcm394_base_device::chipselect_csx_memory_device_control_w(offs_t o m_782x[offset] = data; - static const char* const md[] = + static char const *const md[] = { "(00) ROM / SRAM", "(01) ROM / SRAM", @@ -2003,14 +2003,14 @@ void sunplus_gcm394_base_device::device_add_mconfig(machine_config &config) m_spg_video->space_read_callback().set(FUNC(sunplus_gcm394_base_device::read_space)); m_spg_video->set_video_space(DEVICE_SELF, AS_PROGRAM); - TIMER(config, "timer_a").configure_generic(FUNC(sunplus_gcm394_base_device::timer_a_cb)); - TIMER(config, "timer_b").configure_generic(FUNC(sunplus_gcm394_base_device::timer_b_cb)); - TIMER(config, "timer_c").configure_generic(FUNC(sunplus_gcm394_base_device::timer_c_cb)); - TIMER(config, "timer_d").configure_generic(FUNC(sunplus_gcm394_base_device::timer_d_cb)); - TIMER(config, "timer_e").configure_generic(FUNC(sunplus_gcm394_base_device::timer_e_cb)); - TIMER(config, "timer_f").configure_generic(FUNC(sunplus_gcm394_base_device::timer_f_cb)); + TIMER(config, m_timer_a).configure_generic(FUNC(sunplus_gcm394_base_device::timer_a_cb)); + TIMER(config, m_timer_b).configure_generic(FUNC(sunplus_gcm394_base_device::timer_b_cb)); + TIMER(config, m_timer_c).configure_generic(FUNC(sunplus_gcm394_base_device::timer_c_cb)); + TIMER(config, m_timer_d).configure_generic(FUNC(sunplus_gcm394_base_device::timer_d_cb)); + TIMER(config, m_timer_e).configure_generic(FUNC(sunplus_gcm394_base_device::timer_e_cb)); + TIMER(config, m_timer_f).configure_generic(FUNC(sunplus_gcm394_base_device::timer_f_cb)); - TIMER(config, "scheduler").configure_generic(FUNC(sunplus_gcm394_base_device::scheduler_cb)); + TIMER(config, m_scheduler).configure_generic(FUNC(sunplus_gcm394_base_device::scheduler_cb)); } diff --git a/src/devices/machine/generalplus_gpl951xx_soc.cpp b/src/devices/machine/generalplus_gpl951xx_soc.cpp index 711c8fff7..aa32108d8 100644 --- a/src/devices/machine/generalplus_gpl951xx_soc.cpp +++ b/src/devices/machine/generalplus_gpl951xx_soc.cpp @@ -679,7 +679,7 @@ void generalplus_gpl951xx_device::tft_ctrl_w(u16 data) u8 clk_s = (data & 0x000e) >> 1; u8 tften = (data & 0x0001) >> 0; - static const char* modenames[16] = + static char const *const modenames[16] = { "0: UPS051 mode", "1: UPS052 mode", @@ -1884,19 +1884,19 @@ void generalplus_gpl951xx_device::device_add_mconfig(machine_config &config) m_spg_video->space_read_callback().set(FUNC(generalplus_gpl951xx_device::read_space)); m_spg_video->set_video_space(DEVICE_SELF, AS_PROGRAM); - TIMER(config, "timer_a").configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<0>)); - TIMER(config, "timer_b").configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<1>)); - TIMER(config, "timer_c").configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<2>)); - TIMER(config, "timer_d").configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<3>)); + TIMER(config, m_timer[0]).configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<0>)); + TIMER(config, m_timer[1]).configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<1>)); + TIMER(config, m_timer[2]).configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<2>)); + TIMER(config, m_timer[3]).configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<3>)); // timers e and f are a little different - TIMER(config, "timer_e").configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<4>)); - TIMER(config, "timer_f").configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<5>)); + TIMER(config, m_timer[4]).configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<4>)); + TIMER(config, m_timer[5]).configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<5>)); // timers g and h are for the cha/chb DAC (and can overflow trigger each other, not the above) - TIMER(config, "timer_g").configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<6>)); - TIMER(config, "timer_h").configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<7>)); + TIMER(config, m_timer[6]).configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<6>)); + TIMER(config, m_timer[7]).configure_generic(FUNC(generalplus_gpl951xx_device::timer_cb<7>)); - TIMER(config, "adc_timer").configure_generic(FUNC(generalplus_gpl951xx_device::adc_timer_cb)); + TIMER(config, m_adc_timer).configure_generic(FUNC(generalplus_gpl951xx_device::adc_timer_cb)); GPL951XX_RTC(config, m_rtc, 0); } diff --git a/src/devices/machine/generalplus_gpl_timebase.cpp b/src/devices/machine/generalplus_gpl_timebase.cpp index ff0fddf2a..c9b5d4e2d 100644 --- a/src/devices/machine/generalplus_gpl_timebase.cpp +++ b/src/devices/machine/generalplus_gpl_timebase.cpp @@ -49,7 +49,7 @@ attotime gpl_timebase_device::get_timer_period(int timer, int ctrlval) // Timebase ('fixed' frequency timers) // (each can select from 3 different frequencies, different for each timer) -template +template TIMER_DEVICE_CALLBACK_MEMBER( gpl_timebase_device::timebase_cb ) { // sets bit 15 in m_timebase_ctrl[2], also visible (as read only) in P_INT_Status2, bit 8 @@ -78,13 +78,15 @@ TIMER_DEVICE_CALLBACK_MEMBER( gpl_timebase_device::timebase_cb ) // 1 TMBAS[1] // 0 TMBAS[0] 00 = Reserved, 01 = 1Hz, 10 = 2Hz, 11 = 4Hz -template u16 gpl_timebase_device::timebase_ctrl_r() +template +u16 gpl_timebase_device::timebase_ctrl_r() { LOGMASKED(LOG_TIMEBASE, "%s:sunplus_gcm394_base_device::timebase%c_ctrl_r\n", machine().describe_context(), 'a'+Timer); return m_timebase_ctrl[Timer]; } -template void gpl_timebase_device::timebase_ctrl_w(u16 data) +template +void gpl_timebase_device::timebase_ctrl_w(u16 data) { LOGMASKED(LOG_TIMEBASE, "%s:sunplus_gcm394_base_device::timebase%c_ctrl_w %04x\n", machine().describe_context(), 'a'+Timer, data); @@ -125,7 +127,7 @@ void gpl_timebase_device::timebasec_ctrl_w(u16 data) { timebase_ctrl_w<2>(data); void gpl_timebase_device::device_add_mconfig(machine_config &config) { - TIMER(config, "timebase_a").configure_generic(FUNC(gpl_timebase_device::timebase_cb<0>)); - TIMER(config, "timebase_b").configure_generic(FUNC(gpl_timebase_device::timebase_cb<1>)); - TIMER(config, "timebase_c").configure_generic(FUNC(gpl_timebase_device::timebase_cb<2>)); + TIMER(config, m_timebasetimer[0]).configure_generic(FUNC(gpl_timebase_device::timebase_cb<0>)); + TIMER(config, m_timebasetimer[1]).configure_generic(FUNC(gpl_timebase_device::timebase_cb<1>)); + TIMER(config, m_timebasetimer[2]).configure_generic(FUNC(gpl_timebase_device::timebase_cb<2>)); } diff --git a/src/devices/machine/generalplus_gpl_timebase.h b/src/devices/machine/generalplus_gpl_timebase.h index bac4c1f3f..7e2a6350d 100644 --- a/src/devices/machine/generalplus_gpl_timebase.h +++ b/src/devices/machine/generalplus_gpl_timebase.h @@ -12,10 +12,10 @@ class gpl_timebase_device : public device_t public: gpl_timebase_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template bool timebase_irq_flag() { return ((m_timebase_ctrl[Timer] & 0x8000) && (m_timebase_ctrl[Timer] & 0x4000)) ? true : false; } - auto updateirqs_callback() { return m_updateirqs_cb.bind(); } + template bool timebase_irq_flag() { return ((m_timebase_ctrl[Timer] & 0x8000) && (m_timebase_ctrl[Timer] & 0x4000)) ? true : false; } + u16 timebasea_ctrl_r(); u16 timebaseb_ctrl_r(); u16 timebasec_ctrl_r(); @@ -32,10 +32,10 @@ protected: virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; private: - template TIMER_DEVICE_CALLBACK_MEMBER(timebase_cb); + template TIMER_DEVICE_CALLBACK_MEMBER(timebase_cb); - template u16 timebase_ctrl_r(); - template void timebase_ctrl_w(u16 data); + template u16 timebase_ctrl_r(); + template void timebase_ctrl_w(u16 data); attotime get_timer_period(int timer, int ctrlval); diff --git a/src/mame/handheld/generalplus_gpl951xx.cpp b/src/mame/handheld/generalplus_gpl951xx.cpp index 7020f8cd7..4a3e09fcc 100644 --- a/src/mame/handheld/generalplus_gpl951xx.cpp +++ b/src/mame/handheld/generalplus_gpl951xx.cpp @@ -3,13 +3,14 @@ #include "emu.h" -#include "screen.h" -#include "speaker.h" +#include "unknown_bftetris_lcdc.h" #include "machine/generalplus_gpl951xx_soc.h" #include "machine/generic_spi_flash.h" -#include "unknown_bftetris_lcdc.h" +#include "screen.h" +#include "speaker.h" + namespace { diff --git a/src/mame/handheld/unknown_bftetris_lcdc.cpp b/src/mame/handheld/unknown_bftetris_lcdc.cpp index cffc25436..adf5d6003 100644 --- a/src/mame/handheld/unknown_bftetris_lcdc.cpp +++ b/src/mame/handheld/unknown_bftetris_lcdc.cpp @@ -327,7 +327,7 @@ void bftetris_lcdc_device::lcdc_data_w(u16 data) void bftetris_lcdc_device::device_start() { - std::fill(std::begin(m_displaybuffer), std::end(m_displaybuffer), 0); + m_displaybuffer = make_unique_clear(512 * 256); m_posx = 0; m_posy = 0; m_posminx = 0; @@ -339,7 +339,7 @@ void bftetris_lcdc_device::device_start() m_displayon = 0; m_sleep = 1; - save_item(NAME(m_displaybuffer)); + save_pointer(NAME(m_displaybuffer), 512 * 256); save_item(NAME(m_posx)); save_item(NAME(m_posy)); save_item(NAME(m_posminx)); diff --git a/src/mame/handheld/unknown_bftetris_lcdc.h b/src/mame/handheld/unknown_bftetris_lcdc.h index 7405becdc..f0694da91 100644 --- a/src/mame/handheld/unknown_bftetris_lcdc.h +++ b/src/mame/handheld/unknown_bftetris_lcdc.h @@ -6,7 +6,8 @@ #pragma once -DECLARE_DEVICE_TYPE(UNKNOWN_BFTETRIS_LCDC, bftetris_lcdc_device) +#include + class bftetris_lcdc_device : public device_t { @@ -25,7 +26,7 @@ protected: virtual void device_reset() override ATTR_COLD; private: - u16 m_displaybuffer[512 * 256]; + std::unique_ptr m_displaybuffer; u16 m_posx, m_posy; u16 m_posminx, m_posmaxx; u16 m_posminy, m_posmaxy; @@ -35,4 +36,6 @@ private: u8 m_sleep; }; +DECLARE_DEVICE_TYPE(UNKNOWN_BFTETRIS_LCDC, bftetris_lcdc_device) + #endif // MAME_HANDHELD_UNKNOWN_BFTETRIS_LCDC_H