Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed device_timer, device_timer_id, et al in favor of direct callback members. #9788

Merged
merged 27 commits into from
Jun 4, 2022

Conversation

MooglyGuy
Copy link
Contributor

@MooglyGuy MooglyGuy commented May 20, 2022

Primarily, this removes device_t::device_timer, device_t::timer_set, device_t::synchronize, device_t::timer_expired, and device_timer_id. Use of device_timer often resulted in unnecessary trampolining in addition to switch/case overhead on a driver/device level, and additional logic to manage delegated vs. ID-based timers on a core level. In the worst cases, devices were performing a switch/case with only one valid case.

device_scheduler::timer_set is marked deprecated as the only existing direct use is via the Lua engine, with the remaining uses occurring via device_scheduler::synchronize, which will be removed later in favor of explicitly allocated emu_timer instances.

As a middle ground between the extremely short timer_alloc() and the extremely long machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(widget_device::contoso_tick), this)), a helper function in device_t has been added which can be invoked with the following syntax:
timer_alloc(FUNC(widget_device::contoso_tick), this)

Additional changes/cleanups performed along the way:

  • Converted to use logmacro:
  • src/devices/bus/ieee488/hp9895.cpp
  • src/devices/bus/ieee488/remote488.cpp
  • src/devices/bus/isa/hdc.cpp
  • src/devices/bus/isa/omti8621.cpp
  • src/devices/bus/isa/sc499.cpp
  • src/devices/bus/vip/vp550.cpp
  • src/devices/cpu/i86/i186.cpp
  • src/devices/cpu/lc8670/lc8670.cpp
  • src/devices/machine/68230pit.cpp
  • src/devices/machine/corvushd.cpp
  • src/devices/machine/ds1994.cpp
  • src/devices/machine/ticket.cpp
  • src/mame/audio/pinsnd88.cpp
  • src/mame/drivers/notetaker.cpp
  • src/mame/machine/asic65.cpp
  • src/mame/machine/rmnimbus.cpp
  • src/mame/machine/victor9k_fdc.cpp
  • src/mame/video/uv201.cpp
  • Made usage of m_member prefix consistent:
  • src/devices/bus/isa/hdc.cpp
  • src/devices/bus/isa/omti8621.cpp
  • src/devices/bus/vme/vme_fccpu20.cpp
  • src/devices/machine/ds1386.cpp
  • src/devices/machine/i7220.cpp
  • Spacing consistency pass:
  • src/devices/bus/isa/hdc.cpp
  • src/devices/bus/isa/omti8621.cpp
  • src/devices/bus/thomson/nanoresau.cpp
  • src/devices/bus/ti99/internal/992board.cpp
  • src/devices/bus/ti99/internal/genkbd.cpp
  • src/devices/bus/ti99/internal/joyport/handset.cpp
  • src/devices/bus/vme/vme_fccpu20.cpp
  • src/devices/cpu/i86/i186.cpp
  • src/devices/cpu/lc8670/lc8670.cpp
  • src/devices/machine/68230pit.cpp
  • src/devices/machine/cop452.cpp
  • src/devices/machine/corvushd.cpp
  • src/devices/machine/hp_dc100_tape.cpp
  • src/devices/machine/hp_taco.cpp
  • src/devices/machine/meters.cpp
  • src/devices/machine/microtch.cpp
  • src/devices/machine/phi.cpp
  • src/devices/video/ef9365.cpp
  • src/devices/video/v9938.cpp
  • src/mame/drivers/alphaskop41xx.cpp
  • src/mame/drivers/myb3k.cpp
  • src/mame/drivers/notetaker.cpp
  • src/mame/drivers/wpc_an.cpp
  • src/mame/machine/midikbd.cpp
  • src/mame/machine/rmnimbus.cpp
  • src/mame/machine/wpc_lamp.cpp
  • src/mame/machine/wpc_out.cpp
  • Removed string-based ioport lookups:
  • src/devices/bus/ti99/internal/joyport/handset.cpp
  • src/devices/bus/ti99/internal/joyport/mecmouse.cpp
  • src/devices/bus/vme/vme_hcpu30.cpp
  • src/mame/machine/k7659kb.cpp
  • src/mame/machine/ti85.cpp
  • Adjustments to grammar/wording in comments
  • src/devices/bus/sms_ctrl/lphaser.cpp
  • src/devices/bus/sms_ctrl/sports.cpp
  • src/devices/bus/snes/event.cpp
  • src/devices/bus/snes/sa1.cpp
  • src/devices/bus/thomson/nanoresau.cpp
  • src/devices/bus/z88/z88.cpp
  • src/devices/machine/ds1386.cpp
  • src/devices/machine/vic_pl192.cpp
  • Favored BIT() macro for single-bit checks
  • src/devices/bus/ti99/internal/992board.cpp
  • src/devices/bus/ti99/joyport/handset.cpp
  • src/mame/drivers/notetaker.cpp
  • src/mame/machine/wpc_lamp.cpp
  • src/mame/machine/wpc_out.cpp
  • Removed C89-style variable declarations when noticed
  • src/devices/bus/isa/hdc.cpp
  • src/devices/bus/sms_ctrl/lphaser.cpp
  • src/devices/bus/ti99/joyport/mecmouse.cpp
  • src/devices/machine/acorn_vidc.cpp
  • src/devices/sound/ymz280b.cpp
  • src/devices/video/vic4567.cpp
  • Removed FUNCNAME to avoid compiler-specific #define checks in devices
  • src/devices/bus/vme/vme_fccpu20.cpp
  • src/devices/bus/vme/vme_hcpu30.cpp
  • src/devices/machine/68230pit.cpp
  • src/devices/machine/mc14411.cpp
  • src/mame/drivers/myb3k.cpp
  • Removed unecessary member prefixes/suffixes
  • src/devices/video/ef9340_1.cpp
  • src/mame/drivers/fuukifg2.cpp
  • src/mame/drivers/fuukifg3.cpp
  • src/mame/drivers/intv.cpp
  • src/mame/drivers/simpsons.cpp
  • src/mame/drivers/socrates.cpp
  • src/mame/drivers/special_gambl.cpp
  • src/mame/drivers/sprint4.cpp
  • src/mame/drivers/ti990_10.cpp
  • src/mame/drivers/tubep.cpp
  • src/mame/drivers/vectrex.cpp
  • src/mame/drivers/wpc_an.cpp
  • src/mame/drivers/wpc_dot.cpp
  • src/mame/drivers/wpc_flip1.cpp
  • src/mame/drivers/wpc_flip2.cpp
  • src/mame/machine/z80ne.cpp
  • src/mame/video/rollerg.cpp
  • Switched to lower-case hex constants
  • src/devices/video/ef9365.cpp
  • src/mame/machine/rmnimbus.cpp
  • Re-ordered driver overrides and function members
  • src/mame/drivers/boxer.cpp
  • src/mame/drivers/eurocom2.cpp
  • src/mame/drivers/exidy.cpp
  • src/mame/drivers/gpworld.cpp
  • src/mame/drivers/h19.cpp
  • src/mame/drivers/ibmpcjr.cpp
  • src/mame/drivers/mekd5.cpp
  • src/mame/drivers/mgolf.cpp
  • src/mame/drivers/myb3k.cpp
  • src/mame/drivers/nightmare.cpp
  • src/mame/drivers/notetaker.cpp
  • src/mame/drivers/ptcsol.cpp
  • src/mame/drivers/pwrview.cpp
  • src/mame/drivers/rabbit.cpp
  • src/mame/drivers/sitcom.cpp
  • src/mame/drivers/socrates.cpp
  • src/mame/drivers/sprint4.cpp
  • src/mame/drivers/techno.cpp
  • src/mame/drivers/thayers.cpp
  • src/mame/drivers/ti990_10.cpp
  • src/mame/drivers/ti990_4.cpp
  • src/mame/drivers/tv912.cpp
  • src/mame/drivers/tv990.cpp
  • src/mame/drivers/uchroma68.cpp
  • src/mame/drivers/vk100.cpp
  • src/mame/drivers/votrhv.cpp
  • src/mame/drivers/wicat.cpp
  • src/mame/drivers/wpc_an.cpp
  • src/mame/includes/abc80.h
  • src/mame/includes/asterix.h
  • src/mame/includes/fuukifg2.h
  • src/mame/includes/fuukifg3.h
  • src/mame/includes/gunbustr.h
  • src/mame/includes/intv.h
  • src/mame/includes/namcona1.h
  • src/mame/includes/newbrain.h
  • src/mame/includes/poly.h
  • src/mame/includes/prof80.h
  • src/mame/includes/rollerg.h
  • src/mame/includes/s11.h
  • src/mame/includes/segahang.h
  • src/mame/includes/simpsons.h
  • src/mame/includes/spacefb.h
  • src/mame/includes/tandy2k.h
  • src/mame/includes/trucocl.h
  • src/mame/includes/tubebp.h
  • src/mame/includes/vidbrain.h
  • src/mame/includes/wolfpack.h
  • src/mame/includes/wpc_dot.h
  • Made capitalization consistent on class members
  • src/devices/machine/meters.cpp
  • src/mame/drivers/namcona1.cpp
  • src/mame/drivers/notetaker.cpp

-src/devices/bus/isa/hdc.cpp:

  • Removed fixed-size std::vector in favor of std::unique_ptr

-src/devices/bus/isa/s3virge.cpp:

  • Moved unusually large (for a header) functions into .cpp from header

-src/devices/bus/vip/vp550.cpp

  • Switched to required_device_array to simplify code paths

-src/devices/machine/arm_iomd.cpp

  • Added initializers to constructor
  • Favored std::size over fixed static sizes

-src/devices/machine/ds1386.cpp

  • Moved register #defines into header enums

-src/devices/machine/mc68901.cpp

  • Removed unnecessary parameters and emu_timer::enable calls

-src/devices/machine/mccs1850.cpp

  • Removed inline overuse

-src/devices/machine/meters.cpp

  • Removed unused members

-src/devices/machine/mos6526.cpp

  • Removed inline overuse

-src/devices/machine/nsc810.cpp

  • Converted to arrays rather than individually-numbered members

-src/devices/machine/pxa255.cpp

  • Simplified DMA transfer code

-src/devices/machine/saa1043.cpp

  • Removed extraneous members in favor of resolve_all_safe

-src/devices/machine/vic_pl192.cpp

  • Shifted constructors, start-up, and maps to be at the top of the source file

-src/devices/machine/z8536.cpp

  • Removed stray uses of device_timer_id

-src/devices/sound/cdp1869.cpp

  • Removed inline overuse

-src/devices/sound/mos7360.cpp

  • Converted to arrays rather than individually-numbered members

-src/emu/device.cpp

  • Removed ID-based timer_alloc
  • Removed timer_set
  • Removed synchronize
  • Removed timer_expired
  • Added shorthand timer_alloc to avoid lengthy machine().scheduler().timer_alloc() calls

-src/emu/schedule.cpp

  • Removed now-unused m_id and m_device members

-src/mame/audio/alesis.cpp

  • Added initializers to constructor

-src/mame/drivers/alto2.cpp

  • Removed custom-named driver init in favor of driver_init override
  • Removed octal constant in favor of more standard hex

-src/mame/drivers/astinvad.cpp

  • Fixed 'kamizake' typo

-src/mame/drivers/tm990189.cpp

  • Removed unnecessary machine reset override

-src/mame/drivers/unichamp.cpp

  • Removed custom-named driver init in favor of driver_init override

-src/mame/drivers/votrhv.cpp

  • Fixed ROM_LOAD macros and region() usage in memory maps

-src/mame/machine/victor9k_fdc.cpp

  • Made bracing style consistent across the file

-src/mame/video/gime.cpp

  • Removed unnecessary void specifiers in function prototypes

@MooglyGuy
Copy link
Contributor Author

A full description of all changes has been added.

@MooglyGuy
Copy link
Contributor Author

A fix for a reported issue with midvunit drivers has been pushed.

@cuavas cuavas self-requested a review May 21, 2022 15:23
Copy link
Member

@cuavas cuavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve got through about 450 of the files so far. I’ll add another review when I get through another batch of files.

src/devices/bus/cbus/pc9801_86.h Outdated Show resolved Hide resolved
src/devices/machine/mccs1850.cpp Outdated Show resolved Hide resolved
src/emu/diexec.cpp Show resolved Hide resolved
src/emu/schedule.h Outdated Show resolved Hide resolved
src/devices/video/vic4567.cpp Outdated Show resolved Hide resolved
src/devices/machine/akiko.cpp Outdated Show resolved Hide resolved
src/devices/machine/74123.cpp Outdated Show resolved Hide resolved
src/devices/machine/6522via.cpp Outdated Show resolved Hide resolved
src/devices/cpu/hd61700/hd61700.h Show resolved Hide resolved
src/devices/cpu/hd61700/hd61700.cpp Outdated Show resolved Hide resolved
Copy link
Member

@cuavas cuavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m currently at 866 of 1667 files viewed. I just need a couple more good blocks of time to get through the rest of this.

src/devices/machine/generalplus_gpl16250soc.cpp Outdated Show resolved Hide resolved
src/devices/machine/ldvp931.h Outdated Show resolved Hide resolved
src/devices/machine/netlist.h Outdated Show resolved Hide resolved
src/devices/machine/pit8253.h Outdated Show resolved Hide resolved
src/devices/machine/tms5501.cpp Show resolved Hide resolved
src/devices/sound/pokey.h Outdated Show resolved Hide resolved
src/devices/video/mc6845.cpp Outdated Show resolved Hide resolved
Copy link
Member

@cuavas cuavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently at 1347/1667 files viewed. Found some more parameter values not set in calls to adjust, changes in behaviour, and things that look like they’d be safer using machine().scheduler().synchronize(...).

src/mame/audio/midway.h Show resolved Hide resolved
src/mame/audio/t5182.cpp Outdated Show resolved Hide resolved
src/mame/machine/vino.cpp Outdated Show resolved Hide resolved
src/mame/machine/rx01.cpp Outdated Show resolved Hide resolved
src/mame/machine/psxcd.cpp Outdated Show resolved Hide resolved
src/mame/drivers/itech8.cpp Outdated Show resolved Hide resolved
src/devices/video/ef9365.cpp Outdated Show resolved Hide resolved
src/devices/video/ef9365.cpp Outdated Show resolved Hide resolved
src/devices/video/ef9365.cpp Outdated Show resolved Hide resolved
src/devices/video/ef9365.cpp Outdated Show resolved Hide resolved
…writes, and fixed tabbing/bracing/spacing for consistency.
Copy link
Member

@cuavas cuavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve read all the changes now. Less than a dozen comments in the last 300 or so files.

src/mame/drivers/asterix.cpp Outdated Show resolved Hide resolved
src/mame/drivers/segahang.cpp Outdated Show resolved Hide resolved
src/mame/drivers/segas16a.cpp Outdated Show resolved Hide resolved
src/mame/drivers/exidy.cpp Outdated Show resolved Hide resolved
src/mame/drivers/alto2.cpp Outdated Show resolved Hide resolved
src/mame/drivers/ldplayer.cpp Outdated Show resolved Hide resolved
src/mame/drivers/pcfx.cpp Outdated Show resolved Hide resolved
src/mame/video/vectrex.cpp Outdated Show resolved Hide resolved
src/mame/machine/simpsons.cpp Outdated Show resolved Hide resolved
src/mame/machine/amstrad.cpp Show resolved Hide resolved
@cuavas cuavas mentioned this pull request Jun 3, 2022
@cuavas cuavas merged commit 1bc5484 into mamedev:master Jun 4, 2022
couriersud pushed a commit to couriersud/mame that referenced this pull request Jun 5, 2022
…lback members. (mamedev#9788)

Primarily, this removes device_t::device_timer, device_t::timer_set,
device_t::synchronize, device_t::timer_expired, and device_timer_id.
Use of device_timer often resulted in unnecessary trampolining in
addition to switch/case overhead on a driver/device level, and
additional logic to manage delegated vs. ID-based timers on a core
level.  In the worst cases, devices were performing a switch/case with
only one valid case.

device_scheduler::timer_set is marked deprecated as the only remaining
direct uses are via the Lua engine and a few drivers that need
refactoring anyway.  The remaining uses occur via
device_scheduler::synchronize.

As a middle ground between the extremely short timer_alloc() and the
extremely long
machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(widget_device::contoso_tick), this)),
a helper function in device_t has been added which can be invoked with
the following syntax:
timer_alloc(FUNC(widget_device::contoso_tick), this)

- Additional changes/cleanups performed along the way:

- Converted to use logmacro:
 * src/devices/bus/ieee488/hp9895.cpp
 * src/devices/bus/ieee488/remote488.cpp
 * src/devices/bus/isa/hdc.cpp
 * src/devices/bus/isa/omti8621.cpp
 * src/devices/bus/isa/sc499.cpp
 * src/devices/bus/vip/vp550.cpp
 * src/devices/cpu/i86/i186.cpp
 * src/devices/cpu/lc8670/lc8670.cpp
 * src/devices/machine/68230pit.cpp
 * src/devices/machine/corvushd.cpp
 * src/devices/machine/ds1994.cpp
 * src/devices/machine/ticket.cpp
 * src/mame/audio/pinsnd88.cpp
 * src/mame/drivers/notetaker.cpp
 * src/mame/machine/asic65.cpp
 * src/mame/machine/rmnimbus.cpp
 * src/mame/machine/victor9k_fdc.cpp
 * src/mame/video/uv201.cpp

- Made usage of m_member prefix consistent:
 * src/devices/bus/isa/hdc.cpp
 * src/devices/bus/isa/omti8621.cpp
 * src/devices/bus/vme/vme_fccpu20.cpp
 * src/devices/machine/ds1386.cpp
 * src/devices/machine/i7220.cpp

- Spacing consistency pass:
 * src/devices/bus/isa/hdc.cpp
 * src/devices/bus/isa/omti8621.cpp
 * src/devices/bus/thomson/nanoresau.cpp
 * src/devices/bus/ti99/internal/992board.cpp
 * src/devices/bus/ti99/internal/genkbd.cpp
 * src/devices/bus/ti99/internal/joyport/handset.cpp
 * src/devices/bus/vme/vme_fccpu20.cpp
 * src/devices/cpu/i86/i186.cpp
 * src/devices/cpu/lc8670/lc8670.cpp
 * src/devices/machine/68230pit.cpp
 * src/devices/machine/cop452.cpp
 * src/devices/machine/corvushd.cpp
 * src/devices/machine/hp_dc100_tape.cpp
 * src/devices/machine/hp_taco.cpp
 * src/devices/machine/meters.cpp
 * src/devices/machine/microtch.cpp
 * src/devices/machine/phi.cpp
 * src/devices/video/ef9365.cpp
 * src/devices/video/v9938.cpp
 * src/mame/drivers/alphaskop41xx.cpp
 * src/mame/drivers/myb3k.cpp
 * src/mame/drivers/notetaker.cpp
 * src/mame/drivers/wpc_an.cpp
 * src/mame/machine/midikbd.cpp
 * src/mame/machine/rmnimbus.cpp
 * src/mame/machine/wpc_lamp.cpp
 * src/mame/machine/wpc_out.cpp

- Removed string-based ioport lookups:
 * src/devices/bus/ti99/internal/joyport/handset.cpp
 * src/devices/bus/ti99/internal/joyport/mecmouse.cpp
 * src/devices/bus/vme/vme_hcpu30.cpp
 * src/mame/machine/k7659kb.cpp
 * src/mame/machine/ti85.cpp

- Adjustments to grammar/wording in comments
 * src/devices/bus/sms_ctrl/lphaser.cpp
 * src/devices/bus/sms_ctrl/sports.cpp
 * src/devices/bus/snes/event.cpp
 * src/devices/bus/snes/sa1.cpp
 * src/devices/bus/thomson/nanoresau.cpp
 * src/devices/bus/z88/z88.cpp
 * src/devices/machine/ds1386.cpp
 * src/devices/machine/vic_pl192.cpp

- Favored BIT() macro for single-bit checks
 * src/devices/bus/ti99/internal/992board.cpp
 * src/devices/bus/ti99/joyport/handset.cpp
 * src/mame/drivers/notetaker.cpp
 * src/mame/machine/wpc_lamp.cpp
 * src/mame/machine/wpc_out.cpp

- Removed C89-style variable declarations when noticed
 * src/devices/bus/isa/hdc.cpp
 * src/devices/bus/sms_ctrl/lphaser.cpp
 * src/devices/bus/ti99/joyport/mecmouse.cpp
 * src/devices/machine/acorn_vidc.cpp
 * src/devices/sound/ymz280b.cpp
 * src/devices/video/vic4567.cpp

- Removed FUNCNAME to avoid compiler-specific #define checks in devices
 * src/devices/bus/vme/vme_fccpu20.cpp
 * src/devices/bus/vme/vme_hcpu30.cpp
 * src/devices/machine/68230pit.cpp
 * src/devices/machine/mc14411.cpp
 * src/mame/drivers/myb3k.cpp

- Removed unecessary member prefixes/suffixes
 * src/devices/video/ef9340_1.cpp
 * src/mame/drivers/fuukifg2.cpp
 * src/mame/drivers/fuukifg3.cpp
 * src/mame/drivers/intv.cpp
 * src/mame/drivers/simpsons.cpp
 * src/mame/drivers/socrates.cpp
 * src/mame/drivers/special_gambl.cpp
 * src/mame/drivers/sprint4.cpp
 * src/mame/drivers/ti990_10.cpp
 * src/mame/drivers/tubep.cpp
 * src/mame/drivers/vectrex.cpp
 * src/mame/drivers/wpc_an.cpp
 * src/mame/drivers/wpc_dot.cpp
 * src/mame/drivers/wpc_flip1.cpp
 * src/mame/drivers/wpc_flip2.cpp
 * src/mame/machine/z80ne.cpp
 * src/mame/video/rollerg.cpp

- Switched to lower-case hex constants
 * src/devices/video/ef9365.cpp
 * src/mame/machine/rmnimbus.cpp

- Re-ordered driver overrides and function members
 * src/mame/drivers/boxer.cpp
 * src/mame/drivers/eurocom2.cpp
 * src/mame/drivers/exidy.cpp
 * src/mame/drivers/gpworld.cpp
 * src/mame/drivers/h19.cpp
 * src/mame/drivers/ibmpcjr.cpp
 * src/mame/drivers/mekd5.cpp
 * src/mame/drivers/mgolf.cpp
 * src/mame/drivers/myb3k.cpp
 * src/mame/drivers/nightmare.cpp
 * src/mame/drivers/notetaker.cpp
 * src/mame/drivers/ptcsol.cpp
 * src/mame/drivers/pwrview.cpp
 * src/mame/drivers/rabbit.cpp
 * src/mame/drivers/sitcom.cpp
 * src/mame/drivers/socrates.cpp
 * src/mame/drivers/sprint4.cpp
 * src/mame/drivers/techno.cpp
 * src/mame/drivers/thayers.cpp
 * src/mame/drivers/ti990_10.cpp
 * src/mame/drivers/ti990_4.cpp
 * src/mame/drivers/tv912.cpp
 * src/mame/drivers/tv990.cpp
 * src/mame/drivers/uchroma68.cpp
 * src/mame/drivers/vk100.cpp
 * src/mame/drivers/votrhv.cpp
 * src/mame/drivers/wicat.cpp
 * src/mame/drivers/wpc_an.cpp
 * src/mame/includes/abc80.h
 * src/mame/includes/asterix.h
 * src/mame/includes/fuukifg2.h
 * src/mame/includes/fuukifg3.h
 * src/mame/includes/gunbustr.h
 * src/mame/includes/intv.h
 * src/mame/includes/namcona1.h
 * src/mame/includes/newbrain.h
 * src/mame/includes/poly.h
 * src/mame/includes/prof80.h
 * src/mame/includes/rollerg.h
 * src/mame/includes/s11.h
 * src/mame/includes/segahang.h
 * src/mame/includes/simpsons.h
 * src/mame/includes/spacefb.h
 * src/mame/includes/tandy2k.h
 * src/mame/includes/trucocl.h
 * src/mame/includes/tubebp.h
 * src/mame/includes/vidbrain.h
 * src/mame/includes/wolfpack.h
 * src/mame/includes/wpc_dot.h

- Made capitalization consistent on class members
 * src/devices/machine/meters.cpp
 * src/mame/drivers/namcona1.cpp
 * src/mame/drivers/notetaker.cpp

-src/devices/bus/isa/hdc.cpp:
 * Removed fixed-size std::vector in favor of std::unique_ptr

-src/devices/bus/isa/s3virge.cpp:
 * Moved unusually large (for a header) functions into .cpp from header

-src/devices/bus/vip/vp550.cpp
 * Switched to required_device_array to simplify code paths

-src/devices/machine/arm_iomd.cpp
 * Added initializers to constructor
 * Favored std::size over fixed static sizes

-src/devices/machine/ds1386.cpp
 * Moved register #defines into header enums

-src/devices/machine/mc68901.cpp
 * Removed unnecessary parameters and emu_timer::enable calls

-src/devices/machine/mccs1850.cpp
 * Removed inline overuse

-src/devices/machine/meters.cpp
 * Removed unused members

-src/devices/machine/mos6526.cpp
 * Removed inline overuse

-src/devices/machine/nsc810.cpp
 * Converted to arrays rather than individually-numbered members

-src/devices/machine/pxa255.cpp
 * Simplified DMA transfer code

-src/devices/machine/saa1043.cpp
 * Removed extraneous members in favor of resolve_all_safe

-src/devices/machine/vic_pl192.cpp
 * Shifted constructors, start-up, and maps to be at the top of the source file

-src/devices/machine/z8536.cpp
 * Removed stray uses of device_timer_id

-src/devices/sound/cdp1869.cpp
 * Removed inline overuse

-src/devices/sound/mos7360.cpp
 * Converted to arrays rather than individually-numbered members

-src/emu/device.cpp
 * Removed ID-based timer_alloc
 * Removed timer_set
 * Removed synchronize
 * Removed timer_expired
 * Added shorthand timer_alloc to avoid lengthy machine().scheduler().timer_alloc() calls

-src/emu/schedule.cpp
 * Removed now-unused m_id and m_device members

-src/mame/audio/alesis.cpp
 * Added initializers to constructor

-src/mame/drivers/alto2.cpp
 * Removed custom-named driver init in favor of driver_init override
 * Removed octal constant in favor of more standard hex

-src/mame/drivers/astinvad.cpp
 * Fixed 'kamizake' typo

-src/mame/drivers/tm990189.cpp
 * Removed unnecessary machine reset override

-src/mame/drivers/unichamp.cpp
 * Removed custom-named driver init in favor of driver_init override

-src/mame/drivers/votrhv.cpp
 * Fixed ROM_LOAD macros and region() usage in memory maps

-src/mame/machine/victor9k_fdc.cpp
 * Made bracing style consistent across the file

-src/mame/video/gime.cpp
 * Removed unnecessary void specifiers in function prototypes
couriersud pushed a commit to couriersud/mame that referenced this pull request Jun 5, 2022
…lback members. (mamedev#9788)

Primarily, this removes device_t::device_timer, device_t::timer_set,
device_t::synchronize, device_t::timer_expired, and device_timer_id.
Use of device_timer often resulted in unnecessary trampolining in
addition to switch/case overhead on a driver/device level, and
additional logic to manage delegated vs. ID-based timers on a core
level.  In the worst cases, devices were performing a switch/case with
only one valid case.

device_scheduler::timer_set is marked deprecated as the only remaining
direct uses are via the Lua engine and a few drivers that need
refactoring anyway.  The remaining uses occur via
device_scheduler::synchronize.

As a middle ground between the extremely short timer_alloc() and the
extremely long
machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(widget_device::contoso_tick), this)),
a helper function in device_t has been added which can be invoked with
the following syntax:
timer_alloc(FUNC(widget_device::contoso_tick), this)

- Additional changes/cleanups performed along the way:

- Converted to use logmacro:
 * src/devices/bus/ieee488/hp9895.cpp
 * src/devices/bus/ieee488/remote488.cpp
 * src/devices/bus/isa/hdc.cpp
 * src/devices/bus/isa/omti8621.cpp
 * src/devices/bus/isa/sc499.cpp
 * src/devices/bus/vip/vp550.cpp
 * src/devices/cpu/i86/i186.cpp
 * src/devices/cpu/lc8670/lc8670.cpp
 * src/devices/machine/68230pit.cpp
 * src/devices/machine/corvushd.cpp
 * src/devices/machine/ds1994.cpp
 * src/devices/machine/ticket.cpp
 * src/mame/audio/pinsnd88.cpp
 * src/mame/drivers/notetaker.cpp
 * src/mame/machine/asic65.cpp
 * src/mame/machine/rmnimbus.cpp
 * src/mame/machine/victor9k_fdc.cpp
 * src/mame/video/uv201.cpp

- Made usage of m_member prefix consistent:
 * src/devices/bus/isa/hdc.cpp
 * src/devices/bus/isa/omti8621.cpp
 * src/devices/bus/vme/vme_fccpu20.cpp
 * src/devices/machine/ds1386.cpp
 * src/devices/machine/i7220.cpp

- Spacing consistency pass:
 * src/devices/bus/isa/hdc.cpp
 * src/devices/bus/isa/omti8621.cpp
 * src/devices/bus/thomson/nanoresau.cpp
 * src/devices/bus/ti99/internal/992board.cpp
 * src/devices/bus/ti99/internal/genkbd.cpp
 * src/devices/bus/ti99/internal/joyport/handset.cpp
 * src/devices/bus/vme/vme_fccpu20.cpp
 * src/devices/cpu/i86/i186.cpp
 * src/devices/cpu/lc8670/lc8670.cpp
 * src/devices/machine/68230pit.cpp
 * src/devices/machine/cop452.cpp
 * src/devices/machine/corvushd.cpp
 * src/devices/machine/hp_dc100_tape.cpp
 * src/devices/machine/hp_taco.cpp
 * src/devices/machine/meters.cpp
 * src/devices/machine/microtch.cpp
 * src/devices/machine/phi.cpp
 * src/devices/video/ef9365.cpp
 * src/devices/video/v9938.cpp
 * src/mame/drivers/alphaskop41xx.cpp
 * src/mame/drivers/myb3k.cpp
 * src/mame/drivers/notetaker.cpp
 * src/mame/drivers/wpc_an.cpp
 * src/mame/machine/midikbd.cpp
 * src/mame/machine/rmnimbus.cpp
 * src/mame/machine/wpc_lamp.cpp
 * src/mame/machine/wpc_out.cpp

- Removed string-based ioport lookups:
 * src/devices/bus/ti99/internal/joyport/handset.cpp
 * src/devices/bus/ti99/internal/joyport/mecmouse.cpp
 * src/devices/bus/vme/vme_hcpu30.cpp
 * src/mame/machine/k7659kb.cpp
 * src/mame/machine/ti85.cpp

- Adjustments to grammar/wording in comments
 * src/devices/bus/sms_ctrl/lphaser.cpp
 * src/devices/bus/sms_ctrl/sports.cpp
 * src/devices/bus/snes/event.cpp
 * src/devices/bus/snes/sa1.cpp
 * src/devices/bus/thomson/nanoresau.cpp
 * src/devices/bus/z88/z88.cpp
 * src/devices/machine/ds1386.cpp
 * src/devices/machine/vic_pl192.cpp

- Favored BIT() macro for single-bit checks
 * src/devices/bus/ti99/internal/992board.cpp
 * src/devices/bus/ti99/joyport/handset.cpp
 * src/mame/drivers/notetaker.cpp
 * src/mame/machine/wpc_lamp.cpp
 * src/mame/machine/wpc_out.cpp

- Removed C89-style variable declarations when noticed
 * src/devices/bus/isa/hdc.cpp
 * src/devices/bus/sms_ctrl/lphaser.cpp
 * src/devices/bus/ti99/joyport/mecmouse.cpp
 * src/devices/machine/acorn_vidc.cpp
 * src/devices/sound/ymz280b.cpp
 * src/devices/video/vic4567.cpp

- Removed FUNCNAME to avoid compiler-specific #define checks in devices
 * src/devices/bus/vme/vme_fccpu20.cpp
 * src/devices/bus/vme/vme_hcpu30.cpp
 * src/devices/machine/68230pit.cpp
 * src/devices/machine/mc14411.cpp
 * src/mame/drivers/myb3k.cpp

- Removed unecessary member prefixes/suffixes
 * src/devices/video/ef9340_1.cpp
 * src/mame/drivers/fuukifg2.cpp
 * src/mame/drivers/fuukifg3.cpp
 * src/mame/drivers/intv.cpp
 * src/mame/drivers/simpsons.cpp
 * src/mame/drivers/socrates.cpp
 * src/mame/drivers/special_gambl.cpp
 * src/mame/drivers/sprint4.cpp
 * src/mame/drivers/ti990_10.cpp
 * src/mame/drivers/tubep.cpp
 * src/mame/drivers/vectrex.cpp
 * src/mame/drivers/wpc_an.cpp
 * src/mame/drivers/wpc_dot.cpp
 * src/mame/drivers/wpc_flip1.cpp
 * src/mame/drivers/wpc_flip2.cpp
 * src/mame/machine/z80ne.cpp
 * src/mame/video/rollerg.cpp

- Switched to lower-case hex constants
 * src/devices/video/ef9365.cpp
 * src/mame/machine/rmnimbus.cpp

- Re-ordered driver overrides and function members
 * src/mame/drivers/boxer.cpp
 * src/mame/drivers/eurocom2.cpp
 * src/mame/drivers/exidy.cpp
 * src/mame/drivers/gpworld.cpp
 * src/mame/drivers/h19.cpp
 * src/mame/drivers/ibmpcjr.cpp
 * src/mame/drivers/mekd5.cpp
 * src/mame/drivers/mgolf.cpp
 * src/mame/drivers/myb3k.cpp
 * src/mame/drivers/nightmare.cpp
 * src/mame/drivers/notetaker.cpp
 * src/mame/drivers/ptcsol.cpp
 * src/mame/drivers/pwrview.cpp
 * src/mame/drivers/rabbit.cpp
 * src/mame/drivers/sitcom.cpp
 * src/mame/drivers/socrates.cpp
 * src/mame/drivers/sprint4.cpp
 * src/mame/drivers/techno.cpp
 * src/mame/drivers/thayers.cpp
 * src/mame/drivers/ti990_10.cpp
 * src/mame/drivers/ti990_4.cpp
 * src/mame/drivers/tv912.cpp
 * src/mame/drivers/tv990.cpp
 * src/mame/drivers/uchroma68.cpp
 * src/mame/drivers/vk100.cpp
 * src/mame/drivers/votrhv.cpp
 * src/mame/drivers/wicat.cpp
 * src/mame/drivers/wpc_an.cpp
 * src/mame/includes/abc80.h
 * src/mame/includes/asterix.h
 * src/mame/includes/fuukifg2.h
 * src/mame/includes/fuukifg3.h
 * src/mame/includes/gunbustr.h
 * src/mame/includes/intv.h
 * src/mame/includes/namcona1.h
 * src/mame/includes/newbrain.h
 * src/mame/includes/poly.h
 * src/mame/includes/prof80.h
 * src/mame/includes/rollerg.h
 * src/mame/includes/s11.h
 * src/mame/includes/segahang.h
 * src/mame/includes/simpsons.h
 * src/mame/includes/spacefb.h
 * src/mame/includes/tandy2k.h
 * src/mame/includes/trucocl.h
 * src/mame/includes/tubebp.h
 * src/mame/includes/vidbrain.h
 * src/mame/includes/wolfpack.h
 * src/mame/includes/wpc_dot.h

- Made capitalization consistent on class members
 * src/devices/machine/meters.cpp
 * src/mame/drivers/namcona1.cpp
 * src/mame/drivers/notetaker.cpp

-src/devices/bus/isa/hdc.cpp:
 * Removed fixed-size std::vector in favor of std::unique_ptr

-src/devices/bus/isa/s3virge.cpp:
 * Moved unusually large (for a header) functions into .cpp from header

-src/devices/bus/vip/vp550.cpp
 * Switched to required_device_array to simplify code paths

-src/devices/machine/arm_iomd.cpp
 * Added initializers to constructor
 * Favored std::size over fixed static sizes

-src/devices/machine/ds1386.cpp
 * Moved register #defines into header enums

-src/devices/machine/mc68901.cpp
 * Removed unnecessary parameters and emu_timer::enable calls

-src/devices/machine/mccs1850.cpp
 * Removed inline overuse

-src/devices/machine/meters.cpp
 * Removed unused members

-src/devices/machine/mos6526.cpp
 * Removed inline overuse

-src/devices/machine/nsc810.cpp
 * Converted to arrays rather than individually-numbered members

-src/devices/machine/pxa255.cpp
 * Simplified DMA transfer code

-src/devices/machine/saa1043.cpp
 * Removed extraneous members in favor of resolve_all_safe

-src/devices/machine/vic_pl192.cpp
 * Shifted constructors, start-up, and maps to be at the top of the source file

-src/devices/machine/z8536.cpp
 * Removed stray uses of device_timer_id

-src/devices/sound/cdp1869.cpp
 * Removed inline overuse

-src/devices/sound/mos7360.cpp
 * Converted to arrays rather than individually-numbered members

-src/emu/device.cpp
 * Removed ID-based timer_alloc
 * Removed timer_set
 * Removed synchronize
 * Removed timer_expired
 * Added shorthand timer_alloc to avoid lengthy machine().scheduler().timer_alloc() calls

-src/emu/schedule.cpp
 * Removed now-unused m_id and m_device members

-src/mame/audio/alesis.cpp
 * Added initializers to constructor

-src/mame/drivers/alto2.cpp
 * Removed custom-named driver init in favor of driver_init override
 * Removed octal constant in favor of more standard hex

-src/mame/drivers/astinvad.cpp
 * Fixed 'kamizake' typo

-src/mame/drivers/tm990189.cpp
 * Removed unnecessary machine reset override

-src/mame/drivers/unichamp.cpp
 * Removed custom-named driver init in favor of driver_init override

-src/mame/drivers/votrhv.cpp
 * Fixed ROM_LOAD macros and region() usage in memory maps

-src/mame/machine/victor9k_fdc.cpp
 * Made bracing style consistent across the file

-src/mame/video/gime.cpp
 * Removed unnecessary void specifiers in function prototypes
mgarlanger added a commit to mgarlanger/mame that referenced this pull request Mar 3, 2023
Fix a copy-n-paste issue that was introduced with restructure of device timer from mamedev#9788
cuavas pushed a commit that referenced this pull request Mar 4, 2023
Fixes a copy/paste error introduced by #9788.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants