Commit Graph

81 Commits

Author SHA1 Message Date
Miodrag Milanovic
dbe8b7f762 Fixed for slot menus + some cleanup (nw) 2012-06-05 18:17:31 +00:00
Miodrag Milanovic
db64d8b966 Perform validation after reading ini file and check system name, fixes issues with ramsize option (no whatsnew) 2012-06-03 12:01:22 +00:00
Miodrag Milanovic
66386231e7 Fix for MT bug #04859 (no whatsnew)
also now in case ram value is not proper it change itself to default value
2012-05-25 17:32:30 +00:00
Miodrag Milanovic
c5c6b43d03 make fix slots not available by command line (nw) 2012-05-23 10:56:14 +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
Angelo Salese
cf4b58b6f6 Clean-ups and version bump 2012-02-19 15:23:23 +00:00
Miodrag Milanovic
438f8781de ups (nw) 2012-02-19 14:16:27 +00:00
Miodrag Milanovic
2c4fdd2625 Added possibility to see subslot devices when they are added from softlist, also removed "const" from get_default_card_software, that enable better usage and no need for it to be like that (no whatsnew) 2012-02-19 14:09:07 +00:00
Miodrag Milanovic
a7343bc628 Moved software checks in front of other checks in clifront
in order to make things more consistent with behaving when cmd line
parameters are sent, also added emuopts support to add newly created
options if some is added with adding software item in slot (no whatsnew)
2012-02-16 13:54:52 +00:00
Miodrag Milanovic
7e5ba6d041 Made aliases for image devices without index, make some exotic cases to work better (no whatsnew) 2012-02-15 15:29:33 +00:00
Miodrag Milanovic
fa10190461 Parameter names are now without : (no whatsnew) 2012-01-25 15:20:11 +00:00
Aaron Giles
ed0207f126 Move devices into a proper hierarchy and handle naming
and paths consistently for devices, I/O ports, memory
regions, memory banks, and memory shares. [Aaron Giles]

NOTE: there are likely regressions lurking here, mostly
due to devices not being properly found. I have temporarily
added more logging to -verbose to help understand what's
going on. Please let me know ASAP if anything that is being
actively worked on got broken.

As before, the driver device is the root device and all 
other devices are owned by it. Previously all devices
were kept in a single master list, and the hierarchy was
purely logical. With this change, each device owns its
own list of subdevices, and the hierarchy is explicitly
manifest. This means when a device is removed, all of its
subdevices are automatically removed as well.

A side effect of this is that walking the device list is
no longer simple. To address this, a new set of iterator
classes is provided, which walks the device tree in a depth
first manner. There is a general device_iterator class for
walking all devices, plus templates for a device_type_iterator
and a device_interface_iterator which are used to build
iterators for identifying only devices of a given type or
with a given interface. Typedefs for commonly-used cases
(e.g., screen_device_iterator, memory_interface_iterator)
are provided. Iterators can also provide counts, and can
perform indexed lookups.

All device name lookups are now done relative to another 
device. The maching_config and running_machine classes now
have a root_device() method to get the root of the hierarchy. 
The  existing machine->device("name") is now equivalent to
machine->root_device().subdevice("name").

A proper and normalized device path structure is now
supported. Device names that start with a colon are
treated as absolute paths from the root device. Device
names can also use a caret (^) to refer to the owning
device. Querying the device's tag() returns the device's
full path from the root. A new method basetag() returns
just the final tag.

The new pathing system is built on top of the 
device_t::subtag() method, so anyone using that will 
automatically support the new pathing rules. Each device
has its own internal map to cache successful lookups so
that subsequent lookups should be very fast.

Updated every place I could find that referenced devices,
memory regions, I/O ports, memory banks and memory shares
to leverage subtag/subdevice (or siblingtag/siblingdevice
which are built on top).

Removed the device_list class, as it doesn't apply any
more. Moved some of its methods into running_machine
instead.

Simplified the device callback system since the new 
pathing can describe all of the special-case devices that
were previously handled manually.

Changed the core output function callbacks to be delegates.

Completely rewrote the validity checking mechanism. The
validity checker is now a proper C++ class, and temporarily
takes over the error and warning outputs. All errors and 
warnings are collected during a session, and then output in
a consistent manner, with an explicit driver and source file
listed for each one, as well as additional device and/or
I/O port contexts where appropriate. Validity checkers 
should no longer explicitly output this information, just
the error, assuming that the context is provided.

Rewrote the software_list_device as a modern device, getting
rid of the software_list_config abstraction and simplifying
things.

Changed the way FLAC compiles so that it works like other
external libraries, and also compiles successfully for MSVC
builds.
2012-01-24 20:18:55 +00:00
Miodrag Milanovic
6913a50490 Enabling load of multi part softlist items on all available device [Fabio Priuli] 2012-01-11 09:43:53 +00:00
Aaron Giles
64f1231c63 Removed old C-based interface to astrings. astring exists only as
a class now. Updated all stragglers (mostly tools) to use the class
form. [Aaron Giles]
2012-01-03 00:21:13 +00:00
Miodrag Milanovic
465ff2d360 Fixed handling slot/image options so it's possible to override slot setting by softlist (no whatsnew) 2011-11-23 08:57:45 +00:00
Miodrag Milanovic
be8bd3552f Move per emulator constants info into separate class [Miodrag Milanovic]
out of log:
This way it is possible to link two or more separated executables with different 
copyright/xml out/name/... in one compilation, just one step closer...
2011-11-17 10:02:55 +00:00
Miodrag Milanovic
3e42c687e8 Fixed loading software with unadorned parameter (no whatsnew) 2011-11-10 08:29:37 +00:00
Miodrag Milanovic
e0f276b74b Change order of parsing in emu_options, so first all slot devices are set and then image devices.
Also update lib/util/options.c so now parsing is not stopped on first unknown parameter, this way order of options in command line is not important for dynamic options (no whatsnew)
2011-11-09 10:28:30 +00:00
Angelo Salese
43a482c6eb Made some fixes/additions to the input system [kanikani]
* Added the possibility to press contradictory direction digital
joystick input at the same time (i.e. up-down, left-right);
* Added the possibility to set an arbitrary value for coin impulses;
* fixed a bug with loop lever routine
* fixed a bug with analog joystick routine


Various fixes in tnzs.c driver [kanikani]
* Plump Pop
  - update DIPSW item (collision between each players' child)
  - added DIPLOCATION
* Extermination
* Arkanoid Revenge of DOH
* Dr.Toppel
* Kageki
* Chuka Taisen
* The Newzealand Story
  - added DIPLOCATION
* Kabuki Z
  - fixed difficulty DIPSW (EASY and MEDIUM is reversed)
  - added DIPLOCATION
* Insector X
  - fixed difficulty DIPSW (based on manual)
  - added DIPLOCATION
  

Various fixes in tmnt.c driver [kanikani]
* T.M.N.T.
  - fixed visible area (garbage on each side is correct (verified on PCB))
  - fixed DIPSW
  - added DIPLOCATION
* Golfing Greats
  - fixed inputs
  - fixed DIPSW
  - added DIPLOCATION
* Trigon
* Cuebrick
* M.I.A.
* Punk Shot
  - fixed DIPSW
  - added DIPLOCATION
* Premiere Soccer
  - added DIPLOCATION


Various fixes in ninjaw.c driver [kanikani]
* Ninja Warriors
  - added DIPSW notes
* Darius II
  - fixed DIPSW
  - fixed game description


Various fixes in twin16.c driver [kanikani]
* Majuu no Oukoku
  - fixed inputs
  - fixed DIPSW
  - added DIPLOCATION
* Gradius II
* Hard Puncher
* M.I.A.
* Cuebrick
  - fixed DIPSW
  - added DIPLOCATION


Fixed DIPSW in Darius II [kanikani]

Fixed DIPSW in Ninja Ryuukenden / Ninja Gaiden [kanikani]

Fixed inputs and DIPSW in toaplan1.c, toaplan2.c, twincobr.c, wardner.c drivers [kanikani]


Various fixes in galaga.c driver [kanikani]
* Bosconian
  - fixed DIPSW
  - fixed DIPLOCATION
* Galaga
* Xevious
* DigDug
  - fixed DIPLOCATION


Fixed DIPSW and DIPLOCATION in segas24.c driver [kanikani]


Fixed DIPSW and DIPLOCATION in segas18.c driver [kanikani]


Fixed DIPSW in segag80r.c driver [kanikani]


Fixed DIPSW in segag80v.c driver [kanikani]


Fixed DIPSW in segald.c driver [kanikani]


Fixed DIPSW in Ninjakun and Penguin-Kun Wars [kanikani]


Various fixes in dec0.c driver [kanikani]
* Heavy Barrel
  - fixed DIPSW
  - fixed DIPLOCATION
* Birdie Try
* Dragon Ninja
* Fighting Fantasy
* Midnight Resistance
  - fixed DIPSW
* Robocop
  - fixed DIPLOCATION


Fixed coinage DIPSW using Sega common setting in segaybd.c,
segaorun.c, segaxbd.c, segahang.c, segae.c, segac2.c, segas16a.c
and segas16b.c drivers [kanikani]


Fixed coinage DIPSW using Konami common setting in chqflag.c, pooyan.c
and rockrage.c drivers [kanikani]

Various fixes in sega16b.c driver [kanikani]
* Ace Attacker
  - added I/O board read routine
* Dunk Shot
  - fixed DIPLOCATION
* Sukeban Janshi Ryuko
  - added DIPSW
* Time Scanner
  - fixed DIPSW

Various fixes in sega16a.c driver [kanikani]
* Ace Attacker
  - changed to use analog device
* Sukeban Janshi Ryuko
  - added DIPSW
* Time Scanner
  - fixed DIPSW


Fixed / added comments in ninjakd2.c driver [kanikani]


Made some video optimizations in toypop.c driver [kanikani]


Fixed inputs and DIPSW in djmain.c driver [kanikani]


Fixed DIPLOCATION in Pop'n Stage [kanikani]
2011-10-23 13:29:16 +00:00
Miodrag Milanovic
7a19f40a95 Corrected adding a slot options, fixes issues visible on PC driver in MESS (no whatsnew) 2011-10-13 12:03:49 +00:00
Miodrag Milanovic
8e84c1f225 Fix for softlist loading (no whatsnew) 2011-07-25 14:56:23 +00:00
Angelo Salese
192c9e04f5 Clean-ups and version bump 2011-07-11 19:36:26 +00:00
Miodrag Milanovic
4add4516fe Made quicklaunch work for slot/image devices (no whatsnew) 2011-07-03 18:21:07 +00:00
Miodrag Milanovic
e1fbe66543 Small core changes to enable making slot device also a image device (no whatsnew) 2011-07-03 17:11:43 +00:00
Miodrag Milanovic
09328e0990 Always parse one more time in case additional devices are added in previous part (no whatsnew) 2011-06-29 09:31:27 +00:00
Angelo Salese
a23c194ed5 Port from MESS, nw 2011-06-28 14:23:18 +00:00
Miodrag Milanovic
ba15f08a16 Added support for multi level slot devices [Miodrag Milanovic]
Now it is possible to attach slot device to other slot device, also
containing multiple image devices under it.
2011-06-27 12:37:56 +00:00
Miodrag Milanovic
7fd9b4fba0 Added support for starting softlist item directly without
marking image device to be mounted on. If soft item is found 
it will be loaded on first image device that have needed 
interface defined [Miodrag Milanovic]
2011-06-15 17:31:06 +00:00
Fabio Priuli
2082b37969 emuopts: added confirm_quit option (defaults to off). when on, pressing ESC you are prompted with
a 'confirm quit' screen rather than directly quit emulation. [MamePlus Team, Mamesick, Fabio Priuli]


out of whatsnew: feel free to suggest a better quit message, if you don't like the one I added.
2011-06-03 16:38:05 +00:00
Angelo Salese
b91ca7e606 Initial frameworking for upcoming artwork updates [Mr. Do] 2011-05-23 16:28:23 +00:00
Aaron Giles
d4138762a7 Coding convention cleanup. 2011-05-05 06:55:15 +00:00
Miodrag Milanovic
eeff4d5133 Added support for dynamic devices, will add more info for log
later when there are more support added (no whatsnew)
2011-05-04 14:47:41 +00:00
Aaron Giles
919913f118 Collapsed device_config and device_t into one class. Updated all
existing modern devices and the legacy wrappers to work in this
environment. This in general greatly simplifies writing a modern
device. [Aaron Giles]

General notes:
 * some more cleanup probably needs to happen behind this change,
   but I needed to get it in before the next device modernization 
   or import from MESS  :)

 * new template function device_creator which automatically defines
   the static function that creates the device; use this instead of
   creating a static_alloc_device_config function

 * added device_stop() method which is called at around the time
   the previous device_t's destructor was called; if you auto_free
   anything, do it here because the machine is gone when the 
   destructor is called

 * changed the static_set_* calls to pass a device_t & instead of
   a device_config *

 * for many devices, the static config structure member names over-
   lapped the device's names for devcb_* functions; in these cases
   the members in the interface were renamed to have a _cb suffix

 * changed the driver_enumerator to only cache 100 machine_configs
   because caching them all took a ton of memory; fortunately this
   implementation detail is completely hidden behind the 
   driver_enumerator interface

 * got rid of the macros for creating derived classes; doing it
   manually is now clean enough that it isn't worth hiding the
   details in a macro
2011-04-27 05:11:18 +00:00
Aaron Giles
00d745ca77 (Big tangle of changes that all happened as I was looking into the ROM
loader rewrite, which is still in progress....)

Replaced mamedriv.c with a new driver list mechanism that is generated
by the build tools. The emulator core now expects the presence of a
file called src/$(TARGET)/$(SUBTARGET).lst which is just a raw list of
driver names, one per line. C and C++ comments are still permitted.
This file is parsed by a new build tool makelist which extracts the
driver names, sorts them, and generates a file called drivlist.c, which
is consumed by the core. [Aaron Giles]

Added new osdcore function osd_malloc_array() which is identical to
osd_malloc() but obviously hints that the underlying allocation is for
an array. Updated all callers to use the appropriate form. Modified the
Windows allocator to only use guard pages for array-style allocations,
allowing us to enable them once again in debug builds. [Aaron Giles]

Created new static class driver_list to wrap accesses to the list of
available drivers. Improved speed of driver lookups by relying on the
presorting done by makelist. [Aaron Giles]

Created helper class driver_enumerator as a helper for iterating through 
the list of drivers. This class supports basic filtering and iteration,
and also serves as a temporary cache of machine_configs. [Aaron Giles]

Created cli_frontend object to wrap all the CLI handling code in
clifront.c. Updated/simplified all the code to take advantage of the
driver_enumerator. [Aaron Giles]

Created media_auditor object to wrap all the auditing functions in
audit.c. Updated all users to the new interface. Note that the new
auditing mechanism is slightly out of sync with the romload code in
terms of finding ROMs owned by devices, so it may mis-report some
issues until the new ROM loading code is in. [Aaron Giles]

Added concept of a per-device searchpath. For most devices, their 
searchpath is just the short name of the device. For driver_devices, the
searchpath is driver[;parent[;bios]]. This searchpath will eventually be
used by the rom loader to find ROMs. For now it is used by the media
auditor only. [Aaron Giles]

Created info_xml_creator object to wrap all the info generation functions
in info.c. Converted the file to C++ and cleaned up the input processing
code. [Aaron Giles]

(not for whatsnew ... Known issues: auditing of CHDs appears busted, and 
debug builds report unfreed memory if you use the built-in game picker)
2011-04-13 20:31:00 +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
fb5091182e Cleanups and version bump. 2011-03-25 16:14:09 +00:00
Aaron Giles
04c9a546b5 Attached emu_options to the machine_config, and the running_machine
inherits it now.
2011-03-10 10:17:30 +00:00
Aaron Giles
06ee6804dd Converted core_options to a class. Removed a bunch of marginal
functionality in favor of alternate mechanisms. Errors are
now reported via an astring rather than via callbacks. Every
option must now specify a type (command, integer, float, string,
boolean, etc). Command behavior has changed so that only one
command is permitted. [Aaron Giles]

Changed fileio system to accept just a raw searchpath instead of
an options/option name combination. [Aaron Giles]

Created emu_options class dervied from core_options which wraps
core emulator options. Added mechanisms to cleanly change the
system name and add/remove system-specific options, versus the
old way using callbacks. Also added read accessors for all the
options, to ensure consistency in how parameters are handled.
Changed most core systems to access emu_options instead of
core_options. Also changed machine->options() to return emu_options.
[Aaron Giles]
 
Created cli_options class derived from emu_options which adds the
command-line specific options. Updated clifront code to leverage
the new class and the new core behaviors. cli_execute() now accepts
a cli_options object when called. [Aaron Giles]

Updated both SDL and Windows to have their own options classes,
derived from cli_options, which add the OSD-specific options on
top of everything else. Added accessors for all the options so
that queries are strongly typed and simplified. [Aaron Giles]

Out of whatsnew: I've surely screwed up some stuff, though I have
smoke tested a bunch of things. Let me know if you hit anything odd.
Also I know this change will impact the WINUI stuff, please let me 
know if there are issues. All the functionality necessary should 
still be present. If it's not obvious, please talk to me before 
adding stuff to the core_options class.
2011-03-03 17:05:24 +00:00
Aaron Giles
1b54456be5 mame_file is now emu_file and is a class. It is required
to pass a core_options object to the constructor, along with
a search path. This required pushing either a running_machine
or a core_options through some code that wasn't previously
ready to handle it. emu_files can be reused over multiple 
open/close sessions, and a lot of core code cleaned up
nicely as things were converted to them.

Also created a file_enumerator class for iterating over files
in a searchpath. This replaces the old mame_openpath functions.

Changed machine->options() to return a reference.

Removed public nvram_open() and fixed jchan/kaneko16 to
stop directly saving NVRAM.

Removed most of the mame_options() calls; this will soon go 
away entirely, so don't add any more.

Added core_options to device_validity_check() so they can be
used to validate things.
2011-02-12 03:47:37 +00:00
Aaron Giles
b3d7e09292 Cleanups and version bump. 2011-01-24 05:09:05 +00:00
Miodrag Milanovic
f3ac110d76 Added new flag for options OPTION_DRIVER_ONLY, and marked bios and ramsize as such, since they do not need to be loaded from parent drivers since those are quite driver dependent (no whatsnew) 2011-01-18 10:31:47 +00:00
Miodrag Milanovic
4725df36ac Fixed some long standing issues with image device config (no whatsnew) 2011-01-17 15:40:31 +00:00
Miodrag Milanovic
9fd74516f6 Made MESS drivers too load config from parent drivers (as MAME) but images are only taken from driver itself or command line (no whatsnew) 2011-01-17 13:37:26 +00:00
Miodrag Milanovic
b11eaf0e46 Cleaned OSD windows and emu part from NEWUI dependencies (no whatsnew) 2011-01-13 09:11:34 +00:00
Miodrag Milanovic
249def5363 - Moved RAM device into emu core [Miodrag Milanovic]
- Moved COMP and CONS macros in driver.h
2011-01-05 12:51:11 +00:00
Miodrag Milanovic
33b47edf95 - Fixed issue with image empty slot [Miodrag Milanovic]
- Default for writeconfig is now 0 for MESS since it is not needed anymore
- Fixed handling of mounted devices on hard reset
- Unified some emuopts code, and removed ifdefs
2010-11-26 13:50:56 +00:00
Aaron Giles
59559fe282 Added support for OSD-generated fonts. The OSD is queried first to see
if it owns a given font (based on the name), and if it does, it is
responsible for generating bitmaps on the fly as characters are requested.

Added new option -uifont to specify the UI font. It can be set to a filename,
in which case a BDF font will be loaded. It can also be set to a font name
(assuming the OSD support is present), in which case the OSD font by that
name is used. The default value is 'default' which can be used by the OSD
to substitute a default font or by the OSD, which will default to ui.bdf
as before. In all cases, it falls back to the built-in font by default if
none of the previous options works.

On Windows, the OSD will default to Tahoma as the font name. Also on
Windows, font names can be specified with [b] to indicate bold or [i] to
indicate italic.
2010-10-24 00:16:54 +00:00
Aaron Giles
c30bcb6948 Fix crash when specifying -effect.
Moved -effect implementation out of OSD code and into core since
the implementations were identical across Windows/SDL and implemented
in the core itself.
2010-10-16 00:55:11 +00:00
Aaron Giles
e4d8baf401 Changed driver_device to expose the game_driver's ROMs through the
device interface. This means all ROMs are now exposed via devices,
and thus the process of enumerating ROMs gets simpler.

Changed all instances of temporarily allocating machine_config objects 
to just put them on the stack for simplicity, letting the destructor 
handle the cleanup work automatically.

Changed machine_config constructor to take a game_driver, from which
the machine_config constructor is obtained. This also means the
resulting machine_config holds a reference to the game_driver.

Changed running_machine constructor to no longer take a game_driver,
since the game_driver is now obtainable via the machine_config.
2010-09-03 05:21:46 +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