Commit Graph

41 Commits

Author SHA1 Message Date
Miodrag Milanovic
0e19f641d3 Cleanups and version bump 2013-01-11 07:32:46 +00:00
Aaron Giles
1a30184903 Final round of struct/union/enum normalization. 2012-09-16 05:24:30 +00:00
Aaron Giles
ab97dc30ef First pass at modernizing struct definitions. 2012-09-15 21:47:30 +00:00
Couriersud
5344166555 updated sdl os-core to compile against stock SDL-2.0 [couriersud].
- The SDL team has moved from 1.3 to 2.0. At the same time, changes were made to allow SDL1.2 and SDL2.0 to coexist. All SDL2.0 include files are now in /usr/include/SDL2.
- Added sdlinc.h to avoid having tons of #ifdef .. #include in the code.
- Scalemode is no longer a per-window setting
- Fixed a bug in YUV rendering.
- Use SDL_GetClipboard (SDL2.0)
- Updated README_SDL20.txt

Currently, SDL 2.0 is only supported on *nix. Volunteers welcome.
2012-02-12 20:59:24 +00:00
Angelo Salese
a449c766a2 Cleanups and version bump 2011-06-05 22:35:20 +00:00
R. Belmont
601301fc95 GCC 4.6 "Variable assigned but not used" fixes, part 6 (no whatsnew) 2011-05-30 03:31:11 +00:00
Miodrag Milanovic
37c0ed3fad Fix compiling debugger in SDL (no whatsnew) 2011-04-28 12:07:50 +00:00
Aaron Giles
af94c692bb Switch to using delegates for some callbacks:
- non-device timer callbacks
 - machine state changing callbacks
 - configuration callbacks
 - per-screen VBLANK callbacks
 - DRC backend callbacks

For the timer case only, I added wrappers for the old-style functions.
Over time, drivers should switch to device timers instead, reducing the
number of timers that are directly allocated through the scheduler.
2011-04-27 20:34:45 +00:00
Olivier Galibert
9300bf632c The scripts did an interesting number on the sdl/debugwin.c file :-) 2011-03-30 20:13:55 +00:00
Aaron Giles
2ad5072023 BIG update.
Remove redundant machine items from address_space and device_t.
Neither machine nor m_machine are directly accessible anymore.
Instead a new getter machine() is available which returns a
machine reference. So:

  space->machine->xxx   ==>  space->machine().xxx
  device->machine->yyy  ==>  device->machine().yyy

Globally changed all running_machine pointers to running_machine
references. Any function/method that takes a running_machine takes
it as a required parameter (1 or 2 exceptions). Being consistent
here gets rid of a lot of odd &machine or *machine, but it does
mean a very large bulk change across the project.

Structs which have a running_machine * now have that variable
renamed to m_machine, and now have a shiny new machine() method
that works like the space and device methods above. Since most of
these are things that should eventually be devices anyway, consider
this a step in that direction.

98% of the update was done with regex searches. The changes are
architected such that the compiler will catch the remaining
errors:

// find things that use an embedded machine directly and replace
// with a machine() getter call
S: ->machine->
R: ->machine\(\)\.

// do the same if via a reference
S: \.machine->
R: \.machine\(\)\.

// convert function parameters to running_machine &
S: running_machine \*machine([^;])
R: running_machine \&machine\1

// replace machine-> with machine.
S: machine->
R: machine\.

// replace &machine() with machine()
S: \&([()->a-z0-9_]+machine\(\))
R: \1

// sanity check: look for this used as a cast
(running_machine &)
// and change to this:
*(running_machine *)
2011-03-29 15:50:04 +00:00
Aaron Giles
af071893a6 Cleanup of machine.h. Shuffled some fields around, and moved several
to private member variables with accessors:

machine->m_respool     ==> machine->respool()
machine->config        ==> machine->config()
machine->gamedrv       ==> machine->system()
machine->m_regionlist  ==> machine->first_region()
machine->sample_rate   ==> machine->sample_rate()

Also converted internal lists to use simple_list.
2011-03-28 09:10:17 +00:00
Aaron Giles
3b41606ca0 running_device -> device_t
They both already existed. No sense in having two names for the
same object type.
2010-12-31 21:42:55 +00:00
Aaron Giles
4a032ab057 Fix F4 shortcut so it explicitly labels the address as a number
by preceding it with "0x". This allows F4 to work properly, for
example, on the 68000 stepping to address a6, which also happens
to be a register name.
2010-11-29 16:23:20 +00:00
Aaron Giles
a2ce61ac6c Converted the expression engine to C++, did the usual cleanup. 2010-11-01 07:48:02 +00:00
Andrew Gardner
216a806fdb [SDL Debugger] Removed an unnecessary assert and brought focus back to
the main debugger window on startup. [Andrew Gardner]
2010-10-23 06:41:57 +00:00
Andrew Gardner
df645b4a72 Fix Linux SDL build. 2010-10-23 06:14:17 +00:00
Aaron Giles
e4beed95a6 Create new class osd_interface to house OSD callbacks. Added new
module osdepend.c with default empty implementations. Changed
mame_execute() and cli_execute() to accept a reference to an
osd_interface which is provided by the caller.

Updated SDL and Windows OSD to create an osd_interface-derived
class and moved their OSD callbacks to be members.
2010-10-21 15:59:44 +00:00
Aaron Giles
3e621b169b Cleanups and version bump. 2010-10-14 07:04:16 +00:00
Andrew Gardner
7c4604633c Debugger (SDL) : Window locations in the SDL debugger are now saved and
loaded at exit and startup. [Andrew Gardner]
2010-09-24 04:13:19 +00:00
Andrew Gardner
79aab2108b **FOR REVIEW**
Log: Added preliminary support for saving debugger window locations. [Andrew Gardner]


(Notes)
* I only save the values for the SDL debugger for now.
* There is no loading of these values yet, but if this patch is confirmed good, 
  loading should be relatively straightforward to add.
* There is a slight chance this might not compile on OSes other than linux.  
  I will be available via e-mail for the next 10 hours and will assist 
  with any compilation problems if they occur.
* The patch seems like the "right way" to do things, but if I am doing anything
  suspect, please feel free to make suggestions and corrections.
2010-09-20 16:00:42 +00:00
Aaron Giles
f7ce43f8fb Cleanup debugger interface some more. 2010-07-06 16:12:53 +00:00
Aaron Giles
8b90eb19d5 Fix SDL debugger. 2010-07-06 02:04:15 +00:00
Aaron Giles
5d21c672af Moved debugging structure away from CPUs only and attached to all
devices. Debugger now creates one for each device. C++-ified most
debugger operations to hang off the debugging class, and updated
most callers. This still needs a little cleanup, but it fixes most
issues introduced when the CPUs were moved to their own devices.

Got rid of cpu_count, cpu_first, cpu_next, etc. as they were badly 
broken. Also removed cpu_is_executing, cpu_is_suspended,
cpu_get_local_time, and cpu_abort_timeslice.

Some minor name changes:
  state_value() -> state()
  state_set_value() -> set_state()
2010-07-06 00:52:36 +00:00
Aaron Giles
733b797a3d Split mame.c into mame.c and machine.c, the latter containing the
running_machine definition and implementation.

Moved global machine-level operations and accessors into methods on the
running_machine class. For the most part, this doesn't affect drivers
except for a few occasional bits:

  mame_get_phase() == machine->phase()
  add_reset_callback() == machine->add_notifier(MACHINE_NOTIFY_RESET, ...)
  add_exit_callback() == machine->add_notifier(MACHINE_NOTIFY_EXIT, ...)
  mame_get_base_datetime() == machine->base_datetime()
  mame_get_current_datetime() == machine->current_datetime()

Cleaned up the region_info class, removing most global region accessors
except for memory_region() and memory_region_length(). Again, this doesn't
generally affect drivers.
2010-06-30 03:46:21 +00:00
Aaron Giles
29b6b0de41 C++-ified the debugger views. Not quite architecturally where I would
like them, but it's a start. Split implementation of individual view
types out to separate files. Updated all callers.

Also:
 * fixed okim6295 memory view
 * changed emualloc to free resource pools from earliest to latest
    so that early objects can safely clean up stuff they allocated
2010-06-25 05:11:42 +00:00
R. Belmont
3f3200082a SDL: fix compiling with GTK+ debugger 2010-06-08 14:21:52 +00:00
Aaron Giles
100564d412 WARNING: There are likely to be regressions in both functionality and
performance as a result of this change. Do not panic; report issues to the
list in the short term and I will look into them. There are probably also
some details I forgot to mention. Please ask questions if anything is not
clear.

NOTE: This is a major internal change to the way devices are handled in
MAME. There is a small impact on drivers, but the bulk of the changes are
to the devices themselves. Full documentation on the new device handling
is in progress at http://mamedev.org/devwiki/index.php/MAME_Device_Basics

Defined two new casting helpers: [Aaron Giles]

  downcast<type>(value) should be used for safe and efficient downcasting
  from a base class to a derived class. It wraps static_cast<> by adding
  an assert that a matching dynamic_cast<> returns the same result in 
  debug builds.
  
  crosscast<type>(value) should be used for safe casting from one type to
  another in multiple inheritance scenarios. It compiles to a 
  dynamic_cast<> plus an assert on the result. Since it does not optimize
  down to static_cast<>, you should prefer downcast<> over crosscast<>
  when you can.
  
Redefined running_device to be a proper C++ class (now called device_t).
Same for device_config (still called device_config). All devices and
device_configs must now be derived from these base classes. This means
each device type now has a pair of its own unique classes that describe
the device. Drivers are encouraged to use the specific device types
instead of the generic running_device or device_t classes. Drivers that
have a state class defined in their header file are encouraged to use
initializers off the constructor to locate devices. [Aaron Giles]

Removed the following fields from the device and device configuration
classes as they never were necessary or provided any use: device class,
device family, source file, version, credits. [Aaron Giles]

Added templatized variant of machine->device() which performs a downcast
as part of the device fetch. Thus machine->device<timer_device>("timer")
will locate a device named "timer", downcast it to a timer_device, and
assert if the downcast fails. [Aaron Giles]

Removed most publically accessible members of running_device/device_t in
favor of inline accessor functions. The only remaining public member is
machine. Thus all references to device->type are now device->type(), etc.
[Aaron Giles]

Created a number of device interface classes which are designed to be mix-
ins for the device classes, providing specific extended functionality and
information. There are standard interface classes for sound, execution,
state, nvram, memory, and disassembly. Devices can opt into 0 or more of
these classes. [Aaron Giles]

Converted the classic CPU device to a standard device that uses the
execution, state, memory, and disassembly interfaces. Used this new class
(cpu_device) to implement the existing CPU device interface. In the future
it will be possible to convert each CPU core to its own device type, but 
for now they are still all CPU devices with a cpu_type() that specifies
exactly which kind of CPU. [Aaron Giles] 

Created a new header devlegcy.h which wraps the old device interface using
some special template classes. To use these with an existing device,
simply remove from the device header the DEVICE_GET_INFO() declaration and
the #define mapping the ALL_CAPS name to the DEVICE_GET_INFO. In their
place #include "devlegcy.h" and use the DECLARE_LEGACY_DEVICE() macro.
In addition, there is a DECLARE_LEGACY_SOUND_DEVICE() macro for wrapping
existing sound devices into new-style devices, and a 
DECLARE_LEGACY_NVRAM_DEVICE() for wrapping NVRAM devices. Also moved the
token and inline_config members to the legacy device class, as these are
not used in modern devices. [Aaron Giles]

Converted the standard base devices (VIDEO_SCREEN, SPEAKER, and TIMER) 
from legacy devices to the new C++ style. Also renamed VIDEO_SCREEN to
simply SCREEN. The various global functions that were previously used to
access information or modify the state of these devices are now replaced
by methods on the device classes. Specifically:

  video_screen_configure()             == screen->configure()
  video_screen_set_visarea()           == screen->set_visible_area()
  video_screen_update_partial()        == screen->update_partial()
  video_screen_update_now()            == screen->update_now()
  video_screen_get_vpos()              == screen->vpos()
  video_screen_get_hpos()              == screen->hpos()
  video_screen_get_vblank()            == screen->vblank()
  video_screen_get_hblank()            == screen->hblank()
  video_screen_get_width()             == screen->width()
  video_screen_get_height()            == screen->height()
  video_screen_get_visible_area()      == screen->visible_area()
  video_screen_get_time_until_pos()    == screen->time_until_pos()
  video_screen_get_time_until_vblank_start() == 
                                 screen->time_until_vblank_start()
  video_screen_get_time_until_vblank_end() == 
                                 screen->time_until_vblank_end()
  video_screen_get_time_until_update() == screen->time_until_update()
  video_screen_get_scan_period()       == screen->scan_period()
  video_screen_get_frame_period()      == screen->frame_period()
  video_screen_get_frame_number()      == screen->frame_number()

  timer_device_adjust_oneshot()        == timer->adjust()
  timer_device_adjust_periodic()       == timer->adjust()
  timer_device_reset()                 == timer->reset()
  timer_device_enable()                == timer->enable()
  timer_device_enabled()               == timer->enabled()
  timer_device_get_param()             == timer->param()
  timer_device_set_param()             == timer->set_param()
  timer_device_get_ptr()               == timer->get_ptr()
  timer_device_set_ptr()               == timer->set_ptr()
  timer_device_timeelapsed()           == timer->time_elapsed()
  timer_device_timeleft()              == timer->time_left()
  timer_device_starttime()             == timer->start_time()
  timer_device_firetime()              == timer->fire_time()

Updated all drivers that use the above functions to fetch the specific
device type (timer_device or screen_device) and call the appropriate
method. [Aaron Giles]

Changed machine->primary_screen and the 'screen' parameter to VIDEO_UPDATE
to specifically pass in a screen_device object. [Aaron Giles]

Defined a new custom interface for the Z80 daisy chain. This interface
behaves like the standard interfaces, and can be added to any device that
implements the Z80 daisy chain behavior. Converted all existing Z80 daisy
chain devices to new-style devices that inherit this interface.
[Aaron Giles]

Changed the way CPU state tables are built up. Previously, these were data
structures defined by a CPU core which described all the registers and how
to output them. This functionality is now part of the state interface and
is implemented via the device_state_entry class. Updated all CPU cores
which were using the old data structure to use the new form. The syntax is
currently awkward, but will be cleaner for CPUs that are native new 
devices. [Aaron Giles]

Converted the okim6295 and eeprom devices to the new model. These were
necessary because they both require multiple interfaces to operate and it
didn't make sense to create legacy device templates for these single cases.
(okim6295 needs the sound interface and the memory interface, while eeprom
requires both the nvram and memory interfaces). [Aaron Giles]

Changed parameters in a few callback functions from pointers to references
in situations where they are guaranteed to never be NULL. [Aaron Giles]

Removed MDRV_CPU_FLAGS() which was only used for disabling a CPU. Changed
it to MDRV_DEVICE_DISABLE() instead. Updated drivers. [Aaron Giles]

Reorganized the token parsing for machine configurations. The core parsing
code knows how to create/replace/remove devices, but all device token
parsing is now handled in the device_config class, which in turn will make
use of any interface classes or device-specific token handling for custom
token processing. [Aaron Giles]

Moved many validity checks out of validity.c and into the device interface
classes. For example, address space validation is now part of the memory
interface class. [Aaron Giles]

Consolidated address space parameters (bus width, endianness, etc.) into
a single address_space_config class. Updated all code that queried for
address space parameters to use the new mechanism. [Aaron Giles]
2010-06-08 06:09:57 +00:00
Olivier Galibert
3c6e99b9fa Fix SDL debugger typo. 2010-03-22 20:27:10 +00:00
Aaron Giles
db548c8689 Fix compile error. 2010-03-04 09:32:38 +00:00
Couriersud
a88ab87089 Tidied up includes in a number of files in src/osd/sdl. [couriersud] 2010-02-28 12:16:38 +00:00
Aaron Giles
fe3d7c4af4 Cleanups and version bump. 2010-01-28 08:03:44 +00:00
Couriersud
a8bd722f18 GTK-Debugger
- fix a compile warning for gcc-4.4 (not detected by gcc-4.2)
- Horizontal divider bar to individually size views.
- minimum height aligned to win32 debugger
2010-01-28 00:01:32 +00:00
Couriersud
8afbfd9dca GTK-Debugger
- Functionality now matches win32 debugger
- Further code review/rewrite/simplification
- Added more comment headings
2010-01-26 01:27:35 +00:00
Couriersud
3e7ae30094 GTK-Debugger (SDL)
- implement key handling (Up, down, ..) like in windows
- Tab and ESC not yet handled
2010-01-24 22:14:14 +00:00
R. Belmont
eaf0d1b924 SDL: fixed GTK debugger compile 2010-01-23 03:39:46 +00:00
Couriersud
fb5b325830 GTK-Debugger
- Run to cursor (main view)
- In place memory editing (memory view)

There are still some issue with e.g. scrolling. 
However, it is usable.
2010-01-23 01:08:15 +00:00
Couriersud
3a35df8d63 GTK Debugger work
- glade-2 can now be used again to edit the debug.glade file. 
- No more need to edit the files created by glade-2
- All "activate" handlers now pass the parent window pointer.
- malloc ==> osd_malloc to prevent mixed c++/c window allocations.
2010-01-22 22:16:27 +00:00
Couriersud
81e85ffd7a Bring sdl in line with windows 2010-01-18 23:55:14 +00:00
Aaron Giles
e738b79785 Correct a long-standing design flaw: device configuration state
is now separate from runtime device state. I have larger plans
for devices, so there is some temporary scaffolding to hold
everything together, but this first step does separate things
out.

There is a new class 'running_device' which represents the
state of a live device. A list of these running_devices sits
in machine->devicelist and is created when a running_machine
is instantiated.

To access the configuration state, use device->baseconfig()
which returns a reference to the configuration.

The list of running_devices in machine->devicelist has a 1:1
correspondance with the list of device configurations in
machine->config->devicelist, and most navigation options work
equally on either (scanning by class, type, etc.)

For the most part, drivers will now deal with running_device
objects instead of const device_config objects. In fact, in
order to do this patch, I did the following global search &
replace:

  const device_config -> running_device
  device->static_config -> device->baseconfig().static_config
  device->inline_config -> device->baseconfig().inline_config

and then fixed up the compiler errors that fell out.

Some specifics:

  Removed device_get_info_* functions and replaced them with
  methods called get_config_*.
  
  Added methods for get_runtime_* to access runtime state from
  the running_device.
  
  DEVICE_GET_INFO callbacks are only passed a device_config *.
  This means they have no access to the token or runtime state
  at all. For most cases this is fine.
  
  Added new DEVICE_GET_RUNTIME_INFO callback that is passed
  the running_device for accessing data that is live at runtime.
  In the future this will go away to make room for a cleaner
  mechanism.
  
  Cleaned up the handoff of memory regions from the memory
  subsystem to the devices.
2010-01-18 09:34:43 +00:00
Aaron Giles
aebc07a897 Cleanups and version bump. 2010-01-16 04:12:04 +00:00
R. Belmont
b53bb2c6ac SDLMAME initial import [R. Belmont, Couriersud] 2010-01-13 04:01:20 +00:00