Commit Graph

96 Commits

Author SHA1 Message Date
Scott Stone
545a7e58c0 Added reload_plain flag to softlists (mess import). (no whatsnew) 2011-05-19 02:03:38 +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
Fabio Priuli
52d81e9a8e softlist: moved software list handling (in the Internal UI) to a separate source, and made the code more similar to the File Manager handling code. [Fabio Priuli]
out of whatsnew: this log covers all changes done today, for MAME. A more detailed log will be in MESS whatsnew.
2011-04-06 19:33:27 +00:00
Fabio Priuli
cf505c5805 softlist.c/uiimage.c: char buffer should get cleaned also when Esc is pressed. no whatsnew. 2011-04-06 17:32:05 +00:00
Fabio Priuli
ed669399e3 softlist.c: simplified softlist navigation (from the internal UI) by catching char inputs and searching for matching names among list shortnames. MESS-related -> no whatsnew
this (and the previous commit) adds some duplicate code among file selector menu and softlist menu. I hope to find a clean way to unify the common functions at a later stage.
2011-04-06 17:05:58 +00:00
Fabio Priuli
4e3ad77135 softlist.c: added code to display the softlists entries ordered by shortname in the File Manager (first of the promised improvements ;) ). MESS-related -> no whatsnew 2011-04-06 16:31:56 +00:00
Fabio Priuli
a013cbf6b1 softlist.c: rewritten part of the Internal UI handling for softlists to match the code used by the file selector (this will allow more improvements soon). MESS-related -> no whatsnew 2011-04-06 16:22:23 +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
Fabio Priuli
f25b3a9b88 softlist.c: split the <info> field (added some time ago to handle compatibility requirements) into <info> and <sharedfeat>.
the former stays tied to the whole software entry, the latter gets inherited by each part. 

out of whatsnew 1: Arbee, this change finalizes the xml format once for all. feel free to create an apple II or ||gs list, if you are interested

out of whatsnew 2: 
A bunch of comments about this change: with the latest code, each software entry can store three different kind of 'extrainfo' strings. They are thought to be used in specific cases, so let me briefly explain the big picture behind them.

1. <feature> fields: these are well established in current lists. they belong to a <part> element (i.e. a specific cart or cd disc or floppy disk) and they can be used to store hardware details that belongs to that specific <part>. typically, we have used these to describe the pcb_type of a cart (e.g. the board type in NES carts or in AES carts, to remove the need of specific mappers), so that at loading time they can be checked and the emulation can be setup accordingly. However, some lists (e.g. snes.xml and, in a few months, nes.xml as well) use these more creatively, to e.g. document the exact chip locations on the pcb

examples
<feature name="pcb_type" value="MMC3C"/>
<feature name="u3" value="SRAM-64M"/>

----------
2. <sharedfeat> fields: these are listed in the main <software> entry, but get stored together with the <feature> of each part of this software. E.g. if your software entry consists of 9 floppies, these shared features will be inherited by *all* the disks. The typical usage for this is to list the compatibility requirements of the software entry, e.g. a PAL system, or the presence of an expansion card, or the presence of additional RAM. These compatibility settings have to be manually parsed in the loading code by the driver author, but it makes more sense to define them only once for each software entry than to copy and paste it for each <part> (and believe me, it makes a difference both in terms of avoiding redundant lines and in terms of time necessary to create the xml list itself, when you deal with hundreds of multidisk entries like in the forthcoming pc8801 floppy list). consider this as a shortcut for 1. when you have multidisk software.

examples
<sharedfeat name="compatibility" value="EUR-JPN"/>  (the value can be freely chosen by the driver author as long as he also add the correct values in the loading routine ;) )
<sharedfeat name="addon" value="DVC"/> (this can be of use in cdi titles which won't work without the DigitalVideoCard expansion)

----------
3. <info> fields: these belongs directly to the main <software> entry, like the <sharedfeat>, but they do get stored in the main software entry, not with the <part>. They should be used to store additional info which might be of use for frontends, but that are not strictly necessary for emulation (if you have to describe some fundamental hardware characteristic that has to be checked during emulation, then you should use <sharedfeat> not <info>). Possible examples include the name of the development team, or the serial number of the cart, etc but it's up to the list creator to decide what to use this for and if to use it at all

examples
<info name="developer" value="Treasure"/>
<info name="serial" value="NUS-NSMJ-JPN"/>

As already said, imho the format can now be considered finalized. I cannot really think of anything else that we might want to include in the format, without getting redundant. 

p.s. In fact, some small change is still required in the core to fully support the new fields (e.g. at the moment <info> are not loaded by the core), but the xml format won't be touched.
2011-03-27 00:11:42 +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
9ef0bcf8f2 Cleanups and version bump. 2011-02-28 09:27:05 +00:00
Miodrag Milanovic
c81a150519 softlist wip code to add more info nodes [Fabio Priuli] 2011-02-27 18:05:51 +00:00
Fabio Priuli
8ce41d4daa Fixed CHD hash handling in lists. No whatnew (MESS only) 2011-02-15 16:49:10 +00:00
Aaron Giles
5e4df8c772 Hash generation and general cleanup. New class hash_collection holds
and manages a collection of hashes, and can be built from an internal
format string which is stored with each ROM. All core instances are
cleaned up to use the new interfaces, but it's likely that hashfile
code in MESS will need an update.

Also compacted the form of the hash strings used for ROMs, and fixed
verification/hashing of non-ZIPped files.
2011-02-14 08:41:08 +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
Fabio Priuli
7587b69055 softlist: now we suggest items in compatible lists as well, when choosing best match results. no whatsnew 2011-01-23 18:56:14 +00:00
Fabio Priuli
0b057f9ef7 Added code to display additional software info in the internal file manager (if the software list contains it). No whatsnew needed, being targeted to MESS usage. 2011-01-18 18:49:35 +00:00
Miodrag Milanovic
7d220e5a9e More proper softlist fix (no whatsnew) 2011-01-15 14:48:37 +00:00
Miodrag Milanovic
b929a58a47 Fixed memory leaks in softlist (no whatsnew) 2011-01-15 14:00:59 +00:00
Fabio Priuli
9253300517 added stricter validation for software lists, no whatsnew needed. 2011-01-15 09:14:10 +00:00
Fabio Priuli
330a08aa7a minor fix 2011-01-15 01:21:43 +00:00
Fabio Priuli
00b9bdfb44 Added capability of mounting specific parts of a software element from Internal File Manager. Once again, whatsnew not needed 2011-01-15 00:38:53 +00:00
Fabio Priuli
af54f39fc3 softlists: added WARNING if loading a software with supported="partial" or "no" [Fabio Priuli] 2011-01-14 13:18:56 +00:00
Fabio Priuli
768e020c3a clifront.c: added "-lsoft" option as short version of "-listsoftware" [Fabio Priuli]
out of whatsnew: I also have modified best match for softlists to return 10 results, like in MAME, given that now only the correct list is parsed (thanks to Micko's change)
2011-01-14 07:56:29 +00:00
Fabio Priuli
148ca8dcf9 softlist.c: only output best match if a list is present, limit the scan for best match to the devices with the same interface and fixed a corner case with shortname=listname [Miodrag Milanovic] 2011-01-13 15:09:15 +00:00
Fabio Priuli
e2925112a4 Free allocated memory 2011-01-13 12:23:00 +00:00
Fabio Priuli
484295a27d softlist.c: added best match suggestions to software lists [Fabio Priuli]
out of whatsnew: I also added a couple of helpers which count softlist elements and scan a list up to the n-th element. these are very unoptimized (for large lists) but I found them useful for debugging a few quirks in my first implementation and therefore I'd like to have them in the source.
2011-01-13 08:00:36 +00:00
Fabio Priuli
889709b104 clifront.c: improved the behavior of -listsoftware by updating DTD, by adding output of most missing elements and attributes (softlist description, features & diskdata) and by fixing size and offset formats [Fabio Priuli] 2011-01-12 20:56:24 +00:00
Miodrag Milanovic
321c7048b3 Added support for writable CHD's too (no whatsnew) 2011-01-10 13:02:28 +00:00
Miodrag Milanovic
73fd06883a Added CHD support in softlists [Miodrag Milanovic] 2011-01-10 12:42:28 +00:00
Miodrag Milanovic
bda71c1cd5 Allowed the use of either decimal or hexadecimal values for <dataarea> size, <rom> size, and <rom> offset in software lists. [Curt Coder] 2010-12-04 13:29:12 +00:00
Aaron Giles
3beb0ec246 Converted render.c objects into C++ objects. Updated all callers. 2010-10-13 06:20:10 +00:00
Aaron Giles
7ae55db1ec Cleanups and version bump. 2010-07-22 05:24:06 +00:00
Miodrag Milanovic
2603119e65 Soflist will now load only items from original system by default.
For compatible softlists list name must be explicitly written. (no whatsnew)
2010-07-20 09:10:26 +00:00
Miodrag Milanovic
b797437b3b Added per-device image softlist loading routine [Miodrag Milanovic]
Renamed feof to image_feof (in device_image_interface) in order to compile on FreeBSD [El Barto]
2010-07-07 13:25:03 +00:00
Aaron Giles
30662dcdef Cleanups and version bump. 2010-07-06 17:30:28 +00:00
Miodrag Milanovic
16f14bc5f9 - Added MDRV_SOFTWARE_LIST_COMPATIBLE_ADD for adding compatible software lists (for documentation purposes) [Miodrag Milanovic]
- listsoftware option now return only original software lists
- UI is updated to enable mounting software items per device, it will display only items from list that are for specific device
- Separate compatible software lists in UI
2010-07-06 14:27:51 +00:00
Miodrag Milanovic
4d9a17ee08 Support for multiple software list per driver [Miodrag Milanovic] 2010-07-06 09:27:57 +00:00
Miodrag Milanovic
5cf07785d0 Software list update: [Wilbert Pol]
- Software list xml files are now read in full such that information for clone and parent sets is available.
- Added validity check to check for existence of parent sets.
2010-07-04 19:16:47 +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
41b9dbb9ac Made the machine_config a proper object. Added detokenize method to
this object which can be called multiple times to append new devices
after the initial machine configuration is set up. Updated member
variables to match new naming convention.

Changed the running_machine to take a constructed machine_config
object in the constructor, instead of creating one itself, for
consistency. Also added machine->total_colors() as a shortcut to 
machine->config->m_total_colors.
2010-06-28 06:40:44 +00:00
Miodrag Milanovic
ea8dd94677 - Moved ioproc implementation from MESS [Miodrag Milanovic]
- Implemented more image device calls, and did some cleanup (no whatsnew)
2010-06-23 19:35:49 +00:00
Miodrag Milanovic
c41ede7098 Fixed rewrite error in softlist (no whatsnew) 2010-06-21 14:01:05 +00:00
Miodrag Milanovic
cbe7260a59 - Moved softlist implementation from MESS [Miodrag Milanovic]
- Moved image related UI from MESS to emu core
- Reimplemented filename related image device calls
2010-06-20 18:48:02 +00:00