Commit Graph

86 Commits

Author SHA1 Message Date
AJR
0d2d4cab4f Soft resets no longer turn back clocks on devices
device_rtc_interface: Cleanups and refinements (nw)
- Give RTCs their own phase of machine initialization, right after NVRAM loading
- Make RTC feature flag overrides const, including one new one
- Make rtc_clock_updated a required override
2016-10-09 22:04:32 -04:00
AJR
a237f50680 More consistent use of integer types in tilemap_t and other graphics-related classes (nw)
- Define indirect_pen_t, requiring a slight reordering of emu.h due to an unsurprising dependency
2016-09-03 10:01:39 -04:00
Olivier Galibert
82c408f54c dirom: device_rom_interface for sound chips with rom/memory map alternative [O. Galibert] 2016-08-15 22:36:39 +02:00
mahlemiut
ef22943d01 make ioport_list a map instead of unordered_map, should fix INP incompatibilities across compilers and platforms. 2016-07-25 21:28:19 +12:00
AJR
7f3699e69d More efficient device error logging 2016-06-20 14:31:08 -04:00
Miodrag Milanovic
1c726824f2 Split UI and frontend part from core [Miodrag Milanovic] 2016-04-23 11:26:47 +02:00
Vas Crabb
0c502775b6 remove ui/ui.h dependency from emu.h (for couriersud) 2016-04-10 17:48:38 +10:00
Miodrag Milanovic
2a0c7a0f0b renamed memory.* to emumem.* (nw) 2016-04-08 10:15:48 +02:00
Miodrag Milanovic
e76d30243e Removed I64FMT and SIZETFMT, one usage left in chdman.cpp (nw) 2016-03-07 19:34:44 +01:00
Vas Crabb
a830ea7627 * Support *n conversion in stream_format/string_format
* Make stream_format return characters printed
* Add iostreams with std::vector storage
* Move to type-safe templates for logerror and popmessage
* Remove now-unnecessary I64FMT from calls to logerror/popmessage
* Put some lib/util stuff in util:: namespace
* Some fixes to Japanese translation
2016-03-01 06:52:36 +11:00
Miodrag Milanovic
9527a89b2c cleanup (nw) 2016-02-21 08:52:18 +01:00
Miodrag Milanovic
283fbf13a4 generic machine is now bookkeeping (nw) 2016-01-10 11:39:38 +01:00
Miodrag Milanovic
f1a0a3cb88 Added pre-compiled headers support to build system (nw) 2016-01-01 08:23:58 +01:00
Miodrag Milanovic
3414b0166e tagmap_t to std::unordered_map or std::unordered_set where applicable (nw) 2015-12-09 21:14:13 +01:00
Miodrag Milanovic
92f81361d6 Initial conversion of core to C++14. Note that compilers are now limited to GCC 4.9.0 and up, Clang 3.4.0 and up, and VS2013 and up [Miodrag Milanovic] 2015-12-03 11:40:45 +01:00
Miodrag Milanovic
7e91d39640 no need to include network.h (nw) 2015-11-06 16:08:28 +01:00
Miodrag Milanovic
475e637fb3 removed render.h from emu.h and fix deps (nw) 2015-11-06 14:25:23 +01:00
Miodrag Milanovic
41fea29de5 Relaxed emu.h a bit, should make compile a bit faster (nw) 2015-11-05 20:39:57 +01:00
fulivi
f8cb153519 pty: first step of pseudo terminal implementation
Conflicts:
	scripts/src/bus.lua
2015-10-13 12:00:52 +02:00
Olivier Galibert
cf96ab97bd core: Add per-game parameters [O. Galibert]
Per-game parameters are (tag, value) pairs that follow the same tag
structure than everything else.  They're added within a ROM section
with ROM_PARAMETER(tag, value).  You look them up through the device
method parameter(tag) which returns the string, or "" if not present.

A *lot* of drivers can benefit from that stuff.  It should kill most
game-name keyed tables, and the alternative approach of
bazillon-of-driver-inits.

Possible evolutions, if someone wants to do it:
- output them in -listxml
- push the softlist parameters present in the xml through that
- maybe allow to change/set them through the command line
2015-01-25 20:49:19 +01:00
Miodrag Milanovic
991212c069 -Created machine_manager as singleton class that contains (for now) one running machine [Miodrag Milanovic]
-Updated LUA engine to run in machine_manager instead of being initialized per machine
-Added "-console" option so emulator can be started with LUA enabled console
-Update LUA to version 5.2.3 
-Enabled SQLite3 to be compiled and added LUA module for it
2014-06-06 10:11:31 +00:00
Miodrag Milanovic
546fbff349 devcv2 -> devcb (nw) 2014-05-14 06:46:50 +00:00
Miodrag Milanovic
55bf85dc99 farewell devcb (nw) 2014-05-13 17:05:43 +00:00
Miodrag Milanovic
0c727fc6d3 Small core cleanup (nw) 2014-04-15 11:14:46 +00:00
Alex W. Jackson
c3a166e962 device_gfx_interface [Alex Jackson]
Moved graphics decoding to a new device interface class: device_gfx_interface.
The gfxdecode device is now a device that simply inherits this interface and
does nothing else. Devices that draw tilemaps or sprites using gfx_elements
should in time be updated to use this interface rather than connect to a
machine-global gfxdecode device. Updated toaplan_scu.c as an example (also
fixed off-by-one sprite alignment in twincobr and rallybik while I was at it).

gfx_elements are normally created in interface_post_start(), making it
possible to dynamically create or modify the graphics decoding info during
device_start() if you need to. On the other hand, if you need the gfx_elements
during device_start(), you can directly call decode_gfx() to create them early.

This interface also provides a standard and init-order-safe way to connect to
a palette device (similarly to how device_video_interface helps devices
connect to a screen), so it's handy for any device that does palettized
drawing even if it doesn't use gfx_elements. Updated k053250.c as an example
of this usage.

gfxdecode info entries can now reference shared RAM regions by tag as well as
ROM regions, automatically handle endianness, and have some other new
capabilities. Updated nemesis.c and pgm.c to showcase the new features.

Removed validate_display() (it was just a commented out stub already) since
its only function, checking that drivers don't have an ind16 screen without
a palette, is now done by screen_device::device_validity_check().

Updated obsolete comments about GFXLAYOUT_RAW (cps1.c hasn't used raw gfx for
years, and "to save memory" is no longer a good reason to use it)
2014-04-05 14:59:36 +00:00
Olivier Galibert
65d778cad3 h8: Rewrite [O. Galibert]
(mess) mu100: Main screen turn on [O. Galibert]
2014-03-25 21:53:54 +00:00
Curt Coder
7040e55465 Added device_output_interface and macros MCFG_OUTPUT_INDEX/MCFG_OUTPUT_NAME which can be used to specify which output in the layout a device should use. [Curt Coder]
dm9368: devcb2. (nw)
2014-03-05 15:53:15 +00:00
Jürgen Buchmüller
432a2d29f3 Renamed uimenu.? ==> ui/menu.?, uimain.? ==>
mainmenu.?/miscmenu.?/selgame.?
2014-01-17 03:09:23 +00:00
smf-
cc9b510f9c Slot options can now be configured inline without creating an array. Legacy support for old configuration uses MCFG_FRAGMENT_ADD, which required changing so the current device could be updated by the fragment. [smf] 2013-12-16 19:31:52 +00:00
Aaron Giles
5d0ce54f9e Bulk convert files that already had standard BSD license in my name
to new license tagged form.
2013-10-16 08:14:49 +00:00
Miodrag Milanovic
e72ada1fbd Made both DRC and Non-DRC compile for MIPS, RSP and SH2 core and added option to enable/disable DRC from command line (-drc -nodrc by default it's on) [Miodrag Milanovic] 2013-08-27 12:12:55 +00:00
Aaron Giles
2f1e78d892 Moved tilemap_memory into a generic memory_array class, since it is
more generally useful than just in tilemaps. Code is now in memarray.*

Converted the Atari RLE motion objects device from a half-assed
device into a full-assed device, leveraging the memory_array class.
2013-08-07 03:18:59 +00:00
Oliver Stöneberg
b7de3559c9 removed obsolete legacy define from src/emu/emu.h (nw) 2013-08-02 09:32:20 +00:00
Aaron Giles
25a100d773 Created new device_video_interface. Right now its sole purpose is to
house a screen tag and to find the screen at startup, providing an m_screen
object that can be used. One nice feature is that if there is only one
screen and no screen has been specified, it will auto configure to that
screen. This removes the need to explicitly specify a screen in the
configuration for a large chunk of drivers (though doing so never hurts).
A new macro MCFG_VIDEO_SET_SCREEN is provided, though devices are 
encouraged to define their own that maps there so it is obvious which
device is being targeted. The device_video_interface's validation
function will error if an invalid screen is specified or if no screen
is provided but there are multiple screens present.

Updated all devices that currently had an m_screen in them to use the
device_video_interface instead. This also has the nice benefit of flagging
video-related devices for categorization purposes. It also means all
these devices inherit the same screen-finding behaviors. For devices
that had interfaces that specified a screen tag, those have been removed
and all existing structs updated.

Added an optional_device<screen_device> m_screen to the base driver_device.
If you name your screen "screen" (as most drivers do), you will have free
access to your screen this way.

Future updates include:
* Updating all devices referencing machine.primary_screen to use the
device_video_interface instead
* Updating all drivers referencing machine.primary_screen to use the
m_screen instead
* Removing machine.primary_screen entirely
2013-07-24 19:20:59 +00:00
Aaron Giles
da8170e0af Memory system: added endianness to the memory_share class.
Tilemap system: numerous changes:

 * Moved remaining legacy macros and typedefs to tilelgcy.h. This revealed
   a few drivers mixing and matching modern & legcy, which have now been 
   fixed.

 * Changed get info callback signature to no longer pass the user_data
   pointer, but instead pass a reference to the tilemap object itself.
   Updated those few drivers using user_data to pull it out of the
   tilemap object with the new user_data() getter method.
 
 * Changed get info and mapping callbacks to be device_delegates so that
   they can be described at config time.
 
 * Added tilemap_memory object that is used internally for reading/
   writing to memory that backs a tilemap. This object is used to track
   a memory pointer that backs tilemap memory, and also is designed to
   transparently handle all bus width and endianness associated with
   reading and writing data in a tilemap.
   
 * Incorporated two tilemap_memory objects (basemem and extmem) into the 
   tilemap object and added accessors to them, as well as read/write 
   handlers for reading/writing to entries stored in the memory. This
   means that tilemap get info callbacks can now easily read data out of
   the tilemap in a generic way.
 
 * Rejiggered the initialization sequence for tilemap objects so that
   the tilemap_manager is not required to be present at instantiation.  
 
 * Created a new tilemap_device, which can be used to declare a tilemap
   in the machine config, and which also is a tilemap object itself.
   The tilemap device will look for shared memory regions called
   "<tag>" and "<tag>_ext" and automatically plug them into the tilemap.
   The device also provides write handlers that can be used to write
   to the tilemap memory and mark tiles dirty, saving the need for each 
   driver to write their own.
   
Device system: moved required/optional device finders to a new header
devfind.h.

Atari drivers: removed all playfield and alpha memory and tilemap
variables, apart from those needed by atarivc-using games (this will
become a device in a future update). Updated all Atari 16-bit drivers to
use the new tilemap_device instead, which provides all the needed
functionality in a more generic way.
2013-07-20 21:46:00 +00:00
Miodrag Milanovic
4a09e17523 LUA 5.2.2 added to libraries, did basic hookup of LUA VM into running machine [Miodrag Milanovic]
added -script (or -autoboot_script) command to execute LUA script after driver startup
2013-05-09 13:57:44 +00:00
Miodrag Milanovic
0e19f641d3 Cleanups and version bump 2013-01-11 07:32:46 +00:00
Aaron Giles
ecfbeb7fd0 Created a base class delegate_common_base for all delegate
types. Created a binding_type_exception which is thrown when
a bind attempt fails due to mismatched types.

Added helper templates to driver_device to wrap legacy
device read/write handlers into driver_device member functions.
This should help move some things forward until more common
code is converted into proper devices.

Introduce new module devcb2 which contains modernized
versions of devcb. Compared to previous implementation
this one is simpler overall, trampolining calls through
a single internal set of adapter functions. The new
versions are also designed to be specified in the
machine_config rather than in structures, so they are
no longer simple POD types. Additional new/changed
features:

 * reads and writes can map to delegates for line or 8/16/32/64-bit
 * reads and writes can map to an I/O port
 * reads can be mapped to a constant value, with or without logging
 * writes can be mapped to a device's input line
 * all reads/writes can have a shift, mask, and/or xor applied
 * devices can opt to make the functions safe-if-NULL when resolving
 * only member function types are supported

Rewrote the YM2151 interface to be fully modernized, and
removed the ym2151_interface struct in favor of inline configs
using the new devcb2 mechanism. In many cases, removed
no longer needed trampolines, instead taking advantage of
direct support for input line writes.
2012-10-14 06:28:35 +00:00
Aaron Giles
ea8a131e0d Moved device_delegates into their own files. Employed a
non-templatized helper class so that the code can live
co-located, rather than invading device.h.

Changed the read/write delegates to derive from 
device_delegate. Updated the address map macros to create
these properly.

Removed remnants of the old AM_BASE/SIZE macros from the
memory system.
2012-09-26 10:07:49 +00:00
Aaron Giles
2a88e54278 ioport.c C++ conversion. Mostly internal changes, with no
intended differences from previous behavior. For drivers,
the main change is that input_port_read() no longer exists.
Instead, the port must be fetched from the appropriate device,
and then read() is called.

For member functions, this is actually simpler/cleaner:

  value = ioport("tag")->read()

For legacy functions which have a driver_data state, it goes:

  value = state->ioport("tag")->read()

For other legacy functions, they need to fetch the root device:

  value = machine.root_device().ioport("tag")->read()

The other big change for drivers is that IPT_VBLANK is gone.
Instead, it has been replaced by a device line callback on the
screen device. There's a new macro PORT_VBLANK("tag") which
automatically points things to the right spot.

Here's a set of imperfect search & replace strings to convert
the input_port_read calls and fix up IPT_VBLANK:

input_port_read( *\( *)(machine\(\)) *, *([^)]+ *\))
ioport\1\3->read\(\)

input_port_read( *\( *)(.*machine[()]*) *, *([^)]+ *\))
\2\.root_device\(\)\.ioport\1\3->read\(\)

(state = .*driver_data[^}]+)space->machine\(\)\.root_device\(\)\.
\1state->

(state = .*driver_data[^}]+)device->machine\(\)\.root_device\(\)\.
\1state->

input_port_read_safe( *\( *)(machine\(\)) *, *([^,]+), *([^)]+\))
ioport\1\3->read_safe\(\4\)

IPT_VBLANK( *\))
IPT_CUSTOM\1 PORT_VBLANK("screen")
2012-05-03 09:00:08 +00:00
Aaron Giles
332011b258 Merged watchdog back into running_machine.
Renamed driver overrides to MCFG_MACHINE/SOUND/VIDEO_START_OVERRIDE to
explicitly indicate they are overriding the default behavior.

Put liberatr back the way it used to be.
2012-04-12 08:33:20 +00:00
Aaron Giles
5181e3ea96 Moved soundlatch helpers into driver.c and removed emu/audio/generic.c.
Normalized soundlatch helper function names.

Created delegates for machine/sound/video_start/reset callbacks and
added necessary infrastructure to use them going forward.
2012-04-09 20:23:26 +00:00
Aaron Giles
3324483130 Extracted driver_device base class from machine.* and into its
own file driver.*
2012-04-06 20:24:04 +00:00
Aaron Giles
3e575ad6b9 Move driver list/enumerator to new file drivenum.c/.h.
Move game_driver definition and constants to new header gamedrv.h.
2012-04-06 19:59:27 +00:00
Aaron Giles
24400ec223 Rewrote SAMPLES as a modern device. Updated all callers. FLAC
reading is now done using the FLAC wrapper. There is now a
samples_iterator class to centralize the logic for handling
the sample list walking.

Also redid the cheesy half-baked votrax device since it relied 
on some old samples-based handling. Until we have a real 
implementation, it would be good to route the various clients 
through the current one to at least wire it up properly, even 
if it just plays samples in the end. Will look into that 
shortly.
2012-02-19 01:53:16 +00:00
Aaron Giles
f0823886a6 Major CHD/chdman update. The CHD version number has been increased
from 4 to 5. This means any diff CHDs will no longer work. If you
absolutely need to keep the data for any existing ones you have,
find both the diff CHD and the original CHD for the game in question 
and upgrade using these commands:

  rename diff\game.dif diff\game-old.dif
  chdman copy -i diff\game-old.dif -ip roms\game.chd -o diff\game.dif -op roms\game.chd -c none

Specifics regarding this change:

Defined a new CHD version 5. New features/behaviors of this version:
  - support for up to 4 codecs; each block can use 1 of the 4
  - new LZMA codec, which tends to do better than zlib overall
  - new FLAC codec, primarily used for CDs (but can be applied anywhere)
  - upgraded AVHuff codec now uses FLAC for encoding audio
  - new Huffman codec, used to catch more nearly-uncompressable blocks
  - compressed CHDs now use a compressed map for significant savings
  - CHDs now are aware of a "unit" size; each hunk holds 1 or more units
     (in general units map to sectors for hard disks/CDs)
  - diff'ing against a parent now diffs at the unit level, greatly
     improving compression

Rewrote and modernized chd.c. CHD versions prior to 3 are unsupported,
and version 3/4 CHDs are only supported for reading. Creating a new
CHD now leaves the file open.  Added methods to read and write at the 
unit and byte level, removing the need to handle this manually. Added
metadata access methods that pass astrings and dynamic_buffers to
simplify the interfaces. A companion class chd_compressor now
implements full multithreaded compression, analyzing and compressing
multiple hunks independently in parallel. Split the codec 
implementations out into a separate file chdcodec.*

Updated harddisk.c and cdrom.c to rely on the caching/byte-level read/
write capabilities of the chd_file class. cdrom.c (and chdman) now also 
pad CDs to 4-frame boundaries instead of hunk boundaries, ensuring that
the same SHA1 hashes are produced regardless of the hunk size.

Rewrote chdman.exe entirely, switching from positional parameters to
proper options. Use "chdman help" to get a list of commands, and
"chdman help <command>" to get help for any particular command. Many 
redundant commands were removed now that additional flexibility is
available. Some basic mappings:

  Old: chdman -createblankhd <out.chd> <cyls> <heads> <secs>
  New: chdman createhd -o <out.chd> -chs <cyls>,<heads>,<secs>

  Old: chdman -createuncomphd <in.raw> <out.chd> ....
  New: chdman createhd -i <in.raw> -o <out.chd> -c none ....

  Old: chdman -verifyfix <in.chd>
  New: chdman verify -i <in.chd> -f

  Old: chdman -merge <parent.chd> <diff.chd> <out.chd>
  New: chdman copy -i <diff.chd> -ip <parent.chd> -o <out.chd>

  Old: chdman -diff <parent.chd> <compare.chd> <diff.chd>
  New: chdman copy -i <compare.chd> -o <diff.chd> -op <parent.chd>

  Old: chdman -update <in.chd> <out.chd>
  New: chdman copy -i <in.chd> -o <out.chd>

Added new core file coretmpl.h to hold core template classes. For now
just one class, dynamic_array<> is defined, which acts like an array
of a given object but which can be appended to and/or resized. Also
defines dynamic_buffer as dynamic_array<UINT8> for holding an 
arbitrary buffer of bytes. Expect to see these used a lot.

Added new core helper hashing.c/.h which defines classes for each of
the common hashing methods and creator classes to wrap the 
computation of these hashes. A future work item is to reimplement
the core emulator hashing code using these.

Split bit buffer helpers out into C++ classes and into their own
public header in bitstream.h.

Updated huffman.c/.h to C++, and changed the interface to make it
more flexible to use in nonstandard ways. Also added huffman compression
of the static tree for slightly better compression rates.

Created flac.c/.h as simplified C++ wrappers around the FLAC interface.
A future work item is to convert the samples sound device to a modern
device and leverage this for reading FLAC files.

Renamed avcomp.* to avhuff.*, updated to C++, and added support for
FLAC as the audio encoding mechanism. The old huffman audio is still
supported for decode only.

Added a variant of core_fload that loads to a dynamic_buffer.

Tweaked winwork.c a bit to not limit the maximum number of processors
unless the work queue was created with the WORK_QUEUE_FLAG_HIGH_FREQ
option. Further adjustments here are likely going to be necessary.

Fixed bug in aviio.c which caused errors when reading some AVI files.
2012-02-16 09:47:18 +00:00
Olivier Galibert
afb7d8fb6a floppy: Do specific UI handling [O. Galibert] 2012-01-23 21:49:30 +00:00
Aaron Giles
9cae38e0d8 Converted bitmap_t and rectangle into proper classes. Replaced BITMAP_ADDR*
macros with bitmap->pix* functions, and moved bitmap_fill() to bitmap->fill()
among other similar changes. Bitmap fields now only available via accessors.
Replaced sect_rect with &= and union_rect with |= operators for rectangle
classes. Some general cleanup as a result of these changes. [Aaron Giles]
2011-12-31 07:52:26 +00:00
Miodrag Milanovic
6e79bb2629 Sync with MESS all credited there (no whatsnew) 2011-12-12 14:20:12 +00:00
Miodrag Milanovic
cda1b4765c Commented (per Kale's request) not removed libcothread usage in core (requires clean build), (no whatsnew)
We can safely remove comments and cothread.* from /emu and /lib/cothread if it's confirmed way to go
2011-11-30 16:00:43 +00:00