mirror of
https://github.com/holub/mame
synced 2025-05-24 14:56:21 +03:00
![]() Defined new class driver_data_t, which all driver_data classes must derive from. Updated all class definitions to inherit from the new class, and to call it in the constructor. Also changed the alloc() signature to return a driver_data_t pointer instead of a void *. Renamed and hid machine->driver_data as machine->m_driver_data. Added a new templatized method machine->driver_data<class> which returns a properly downcast'ed version of the driver data. Updated all code which looked like this: mydriver_state *state = (mydriver_state *)machine->driver_data; to this: mydriver_state *state = machine->driver_data<mydriver_state>(); The new function does a downcast<> which in debug builds dynamically verifies that you're actually casting to the right type. Changed atarigen_state to be a base class from which all the related Atari drivers derive their state from. For MESS: this was mostly a bulk search/replace, in 4 steps in src/mame: 1. Add ": public driver_data_t" to each driver state class definition: Search: (class [a-z0-9_]+_state)$ Replace: \1 : public driver_data_t 2. Change the static alloc function to return a driver_data_t *: Search: static void \*alloc\( Replace: static driver_data_t \*alloc\( 3. Change the constructor to initialize driver_data_t: Search: ([a-z0-9_]+_state\(running_machine \&machine\)) { } Replace: \1\r\n\t\t: driver_data_t(machine) { } 4. Replace the state fetchers to use the new templatized function: Search: \(([a-z0-9_]+_state) \*\)(.*)machine->driver_data Replace: \2machine->driver_data<\1>() |
||
---|---|---|
docs | ||
src | ||
.gitattributes | ||
makefile |