Commit Graph

42 Commits

Author SHA1 Message Date
Angelo Salese
e6050ace10 Cleanups and version bump 2011-06-19 19:29:25 +00:00
Miodrag Milanovic
733d00f28e Converted printer image device to modern (no whatsnew) 2011-06-14 10:10:17 +00:00
Miodrag Milanovic
2749c957bc Cleanup of image device base classes and prepare for rewrite (no whatsnew) 2011-06-10 14:54:08 +00:00
Miodrag Milanovic
71f7bbc770 Fix for image device unmount (no whatsnew) 2011-05-10 10:16:52 +00:00
Miodrag Milanovic
be28e96b39 Fixed problem with image devices due to same name in interface and device class (no whatsnew) 2011-05-04 17:33:07 +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
fecfc465df Switch from m_machine to machine() everywhere. In some cases this
meant adding a machine() accessor but it's worth it for consistency.
This will allow future changes from reference to pointer to happen
transparently for devices. [Aaron Giles]

Simple S&R:
m_machine( *[^ (!=;])
machine()\1
2011-04-18 20:06:43 +00:00
Fabio Priuli
bad53a6bdf moved call_display_info() to finish_load(), so that it can exploit variables set at init time.
updated megadrive compatibility check to use the new mechanism instead of the original 
proof of concept implementation. 
no whatsnew.
2011-04-08 07:34:32 +00:00
Fabio Priuli
6e7580add7 cartslot.c/chd_cd.c: added support for a callback function to test softlist sharedfeat (e.g. 'compatibility') and display a warning message accordingly. updated cdi.c as an example [Fabio Priuli]
support for floppy and tapes is in progress, but I have to discuss with Micko first :)
2011-04-07 16:23:29 +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
Miodrag Milanovic
00ee3521a3 Removed hashfile and dependencies (no whatsnew) 2011-02-14 15:49:58 +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
ae5dfca0bf Fix build break from last checkin.
Also replace timer_get_time() with machine->time()

1. Main conversion
timer_get_time( *)\( *([^)]+) *\)
\2->time\1()

2. Cleanup #1
&machine->time
machine.time

3. Cleanup #2
&m_machine->time
m_machine.time
2011-02-06 07:29:03 +00:00
Aaron Giles
1e88333178 Converted attotime to a class, with proper operators. Removed old
global functions which are now superceded by the operators and
methods on the class. [Aaron Giles]

Required mappings are:

attotime_make(a,b)            => attotime(a,b)
attotime_to_double(t)         => t.as_double()
double_to_attotime(d)         => attotime::from_double(d)
attotime_to_attoseconds(t)    => t.as_attoseconds()
attotime_to_ticks(t,f)        => t.as_ticks(f)
ticks_to_attotime(t,f)        => attotime::from_ticks(t,f)
attotime_add(a,b)             => a + b
attotime_add_attoseconds(a,b) => a + attotime(0, b)
attotime_sub(a,b)             => a - b
attotime_sub_attoseconds(a,b) => a - attotime(0, b)
attotime_compare(a,b) == 0    => a == b
attotime_compare(a,b) != 0    => a != b
attotime_compare(a,b) < 0     => a < b
attotime_compare(a,b) <= 0    => a <= b
attotime_compare(a,b) > 0     => a > b
attotime_compare(a,b) >= 0    => a >= b
attotime_mul(a,f)             => a * f
attotime_div(a,f)             => a / f
attotime_min(a,b)             => min(a,b)
attotime_max(a,b)             => max(a,b)
attotime_is_never(t)          => t.is_never()
attotime_string(t,p)          => t.as_string(p)

In addition, some existing #defines still exist but will go away:

attotime_zero                 => attotime::zero
attotime_never                => attotime::never
ATTOTIME_IN_SEC(s)            => attotime::from_seconds(s)
ATTOTIME_IN_MSEC(m)           => attotime::from_msec(m)
ATTOTIME_IN_USEC(u)           => attotime::from_usec(u)
ATTOTIME_IN_NSEC(n)           => attotime::from_nsec(n)
ATTOTIME_IN_HZ(h)             => attotime::from_hz(h)
2011-02-03 07:52:45 +00:00
Aaron Giles
b3d7e09292 Cleanups and version bump. 2011-01-24 05:09:05 +00:00
Fabio Priuli
f21e62fcbf Fixed a stupid segfault introduced by pretending the emu can set the filename of the loaded image also when loading has failed :(
No whatsnew.
2011-01-15 12:57:58 +00:00
Fabio Priuli
b98f54de7b Improved the way software names are displayed by the Internal File Manager when loading from software list and fixed wrong displayed name when loading with shortname:part. No whatsnew needed (being MESS-specific) 2011-01-14 22:07:07 +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
2c106c458a allow software lists to look for files in the rompath too [Fabio Priuli]
out of whatsnew
1. summing up, you can now load roms through softwarelists from: listname/romset, listname/parent + now also romset & parent (like MAME)
2. there is a lot of repeated code, but I still haven't found a satisfactory way to handle the both loading processes in a single function. I'll keep looking into it!
2011-01-13 20:50:27 +00:00
Fabio Priuli
7ee4a870c2 devimage.c: added support for split set to softlist for cass and flop too [Fabio Priuli] 2011-01-13 18:26:34 +00:00
Fabio Priuli
42d3a87923 romload.c: added support for split set to softlist (for cart, cd and hd) [Fabio Priuli]
out of whatsnew: to avoid too much duplicate code, I implemented this as follow: 
for parent, we pass a location tag "list/parentname" to search for the roms (no 
changes in this case); for  clones, we pass a composed location tag 
"list/clonename%list/parentname" (notice the '%' separator) and then it is 
open_rom_file to split it, if it finds a %, before searching for the rom.

out of whatsnew, 2: I also added the same support for cassettes and floppies (in 
devimage.c), but it is still commented out because I had only a few files for testing.
as soon as I'm sure nothing gets broken, I'll enable it.
2011-01-13 17:09:27 +00:00
Fabio Priuli
ce792b2819 fixed bogus creation of empty file when loading through softlists. no whatsnew. 2011-01-13 09:25:58 +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
ab18e234b0 Cleanups and version bump. 2010-08-12 04:24:53 +00:00
Miodrag Milanovic
b8b87c341a Newline at end of devimage.c (no whatsnew) 2010-08-04 08:30:38 +00:00
Miodrag Milanovic
2301c7d1e5 Fixed image device error handling [ShimaPong, Miodrag Milanovic] 2010-08-04 07:49:46 +00:00
Aaron Giles
7ae55db1ec Cleanups and version bump. 2010-07-22 05:24:06 +00:00
Miodrag Milanovic
c09065ef97 Fixed image unload and creation [Sandro Ronco, Miodrag Milanovic] 2010-07-12 13:52:35 +00:00
Miodrag Milanovic
5a4b6fa9a0 Adding ability to support other types of software lists, so floppies, cassettes, cd-roms are now possible to be used [Miodrag Milanovic] 2010-07-08 12:59:21 +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
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
a456b3322d - Fixed compile
- Moved some defines from MESS to MAME
- Cleaned MESS side and therefore removed some includes
(no whatsnew)
2010-06-27 09:58:57 +00:00
Miodrag Milanovic
e3a90fa281 Implemented hash file and battery support and did some cleanup (no whatsnew) 2010-06-24 15:10:53 +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
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
Miodrag Milanovic
333a6d2032 Prevent some overrides of exiting variables, implementation will be updated later (no whatsnew) 2010-06-18 14:13:12 +00:00
Miodrag Milanovic
480c2fcaf6 Changed callback function parameter types for image device (no whatsnew) 2010-06-18 13:49:38 +00:00
Miodrag Milanovic
fd915ad0a4 Implemented most of calls for image device (no whatsnew) 2010-06-18 13:19:56 +00:00
Miodrag Milanovic
826dba5923 - removed MESS dependency from config.c
- moved image legacy device implementation to devimage.c
- created image.c implementation with initialization of devices/configuration for image devices, used those calls from mame.c
- some minor cleanup of legacy device and initial implementation of some calls

(no whatsnew for now, this is just for log,will put more info on final commit)
2010-06-17 20:06:54 +00:00