Commit Graph

61 Commits

Author SHA1 Message Date
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
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
231ad67aef - Added writeconfig option to emuopts (default for MAME is off) to save ini on exit of driver
- Added saving of location of mounted images in ini
(no whatsnew)
2010-06-18 14:40:02 +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
Aaron Giles
861db1eb49 Cleanups and version bump. 2010-06-17 06:55:54 +00:00
R. Belmont
e22a1bf81d More OS X PPC compile fixes (no whatsnew) 2010-06-17 00:33:29 +00:00
Miodrag Milanovic
488fbb0f0f emuopts - added support for image devices parameters [Miodrag Milanovic] 2010-06-16 13:22:10 +00:00
Aaron Giles
6b663f66a7 Cleanups and version bump. 2010-02-14 16:59:22 +00:00
Miodrag Milanovic
a347804fe3 Made uimodekey default to "auto" and let OSD decide about default key. (no credit) 2010-02-14 14:15:55 +00:00
Miodrag Milanovic
0a6b13608d - Moved natural keyboard support from MESS to MAME
- Moved OSD file functions and clipboard access functions into OSD core
2010-02-12 15:40:11 +00:00
Couriersud
0898987bc3 Internal debugger using the mame rendering infrastructure
- added support for arbitrary number of containers for render_target
- added command-line parameter -debug_internal (-di) to use the internal debugger when in debug mode
- internal debugger supports all views except memory view
- added "Debug" view to layout/vertical.lay to create more place for debug views in vertical games.

The colors are ugly. Font rendering needs improvement. There are no shortcut keys right now. There is still a lot of room for more improvements.
However, it works and does not depend on any ui toolkit. The interface has been designed to support displaying views programmatically e.g. from the ui. 

Currently, the ui render target is used. In order to support views being displayed in separate windows further changes are needed:
- the osd layer must support creating and closing windows (render targets) on demand.
- There must be a mode for render targets where their bounds follows the window size - Currently the render target size depends on the aspect of currently selected "artwork" view.
- Render target needs a name property.

Short HowTo:

- Start MAME with "-debug -di"
- Console, register and disasm views will be shown. Place them by dragging the view on the title bar.
- Views can be resized by dragging the bottom-right yellow square.
- The view having the focus has a green background title bar.
- Hit "Tab" (IPT_UI_CONFIGURE) to show the menu.
- Console and disasm views support a very simple facility to support entering commands and addresses. Just start typing. Hit "enter" when finished.
2010-02-11 23:59:36 +00:00
Miodrag Milanovic
51f4cf5be9 Rollback of show_warning add, sorry did not know about policy of this issue. 2010-02-10 10:40:58 +00:00
Miodrag Milanovic
96413ff354 - Added skip_warnings option
- Removed MESS dependent checks
2010-02-10 10:25:00 +00:00
Scott Stone
c6c534dbb6 Minor documentation change. No whatsnew needed. 2010-01-19 14:20:11 +00:00
Aaron Giles
4498faacd9 First round of an attempted cleanup of header files in the system.
- Created new central header "emu.h"; this should be included
    by pretty much any driver or device as the first include. This
    file in turn includes pretty much everything a driver or device
    will need, minus any other devices it references. Note that
    emu.h should *never* be included by another header file.
 - Updated all files in the core (src/emu) to use emu.h.
 - Removed a ton of redundant and poorly-tracked header includes
    from within other header files.
 - Temporarily changed driver.h to map to emu.h until we update
    files outside of the core.

Added class wrapper around tagmap so it can be directly included
and accessed within objects that need it. Updated all users to
embed tagmap objects and changed them to call through the class.

Added nicer functions for finding devices, ports, and regions in
a machine:

   machine->device("tag") -- return the named device, or NULL
   machine->port("tag") -- return the named port, or NULL
   machine->region("tag"[, &length[, &flags]]) -- return the
      named region and optionally its length and flags
      
Made the device tag an astring. This required touching a lot of 
code that printed the device to explicitly fetch the C-string
from it. (Thank you gcc for flagging that issue!)
2010-01-10 00:29:26 +00:00
Aaron Giles
91a1b8d634 NOTE: This change requires two new osd functions: osd_malloc() and
osd_free(). They take the same parameters as malloc() and free().

Renamed mamecore.h -> emucore.h.

New C++-aware memory manager, implemented in emualloc.*. This is a
simple manager that allows you to add any type of object to a
resource pool. Most commonly, allocated objects are added, and so
a set of allocation macros is provided to allow you to manage
objects in a particular pool:

  pool_alloc(p, t) = allocate object of type 't' and add to pool 'p'
  pool_alloc_clear(p, t) = same as above, but clear the memory first
  pool_alloc_array(p, t, c) = allocate an array of 'c' objects of type
                              't' and add to pool 'p'
  pool_alloc_array_clear(p, t, c) = same, but with clearing
  pool_free(p, v) = free object 'v' and remove it from the pool

Note that pool_alloc[_clear] is roughly equivalent to "new t" and
pool_alloc_array[_clear] is roughly equivalent to "new t[c]". Also
note that pool_free works for single objects and arrays.

There is a single global_resource_pool defined which should be used
for any global allocations. It has equivalent macros to the pool_*
macros above that automatically target the global pool.

In addition, the memory module defines global new/delete overrides
that access file and line number parameters so that allocations can
be tracked. Currently this tracking is only done if MAME_DEBUG is
enabled. In debug builds, any unfreed memory will be printed at
the end of the session.

emualloc.h also has #defines to disable malloc/free/realloc/calloc.
Since emualloc.h is included by emucore.h, this means pretty much
all code within the emulator is forced to use the new allocators.
Although straight new/delete do work, their use is discouraged, as
any allocations made with them will not be tracked.

Changed the familar auto_alloc_* macros to map to the resource pool
model described above. The running_machine is now a class and contains
a resource pool which is automatically destructed upon deletion. If
you are a driver writer, all your allocations should be done with
auto_alloc_*.

Changed all drivers and files in the core using malloc/realloc or the 
old alloc_*_or_die macros to use (preferably) the auto_alloc_* macros 
instead, or the global_alloc_* macros if necessary.

Added simple C++ wrappers for astring and bitmap_t, as these need
proper constructors/destructors to be used for auto_alloc_astring and
auto_alloc_bitmap.

Removed references to the winalloc prefix file. Most of its 
functionality has moved into the core, save for the guard page 
allocations, which are now implemented in osd_alloc and osd_free.
2010-01-08 06:05:29 +00:00
Aaron Giles
ba6c280210 Added basic support in bitmap.c for 64-bit indexed bitmaps. As a
result, you will need a full recompile with this change, since the
bitmap formats enum was altered.

Introduced new feature -burnin, which can be used to generate a PNG
that represents the overall brightness seen during the course of
running a game. This PNG can be used as a fake "bezel" that overlays
the screen via the artwork systems (with a low alpha, say 0.1 or 0.2)
to simulate running a game with a monitor that has been burned in
from another game.

Fixed the -crsshairpath option to be spelled properly.
2009-07-13 22:34:43 +00:00
Derrick Renaud
01962d4fc5 Crosshair update
* Added Crosshair Options menu
  - ability to individually enable/disable crosshairs
  - ability for them to automatically disappear after a set amount of time
  - ability to select crosshair graphic
  - all settings are saved in the cfg file
 * Removed F1 toggle for crosshairs
 * Added new command option -crsshairpath
  - store all selectable graphics here
  - see config.txt for further info

OSD NOTE: render_load_png() has been changed to no longer force usage of the artwork directory.
Do a search for "render_load_png(" and replace with "render_load_png(OPTION_ARTPATH, " if needed.

----------------------------
F1 is now free to use for something new.  I was thinking it would be perfect for a context sensitive help file.  Each menu item could have a help tag, that it would look up and display info from an HTML file.
2009-03-28 22:55:34 +00:00
Aaron Giles
8169eeefca 02687: emuopts.c: CORE INPUT AUTOMATIC ENABLE OPTIONS
02683: Pressing F5 while running debugger causes access violation 
02669: pandoras: music tempo is too fast 
02691: Some drivers with z80/ay8910 Audio: Audio tempo has changed 

Also fixed debugger memory leak.

Added a number of new cputag_* macros to cpuexec.h.
2008-12-04 09:34:38 +00:00
Aaron Giles
a69088c498 Added new options 'cheatpath' to specify one or more paths for cheat
files. Removed old option 'cheat_file'.

Updated xmlfile.c to specify the line number for each node, for more
accurate error reporting.

Removed old cheat.c/.h and replaced them with code that will read and
write the new XML-based cheat format using the new cheatpath option
(cheats still need to be enabled in order to load at all). Note that
the cheats are not implemented yet, but they are fully parsed. To test
saving, whenever a cheat file is successfully loaded, it is immediately
written back out as 'output.xml' to the cheat directory for validation.
2008-07-31 08:19:53 +00:00
Aaron Giles
1e7bfa9b94 Update docs a bit. Turn off debugger by default. 2008-06-26 16:51:19 +00:00