Commit Graph

42 Commits

Author SHA1 Message Date
Vas Crabb
6ef4a1452d Revert "(nw) Fixed random crashing when swapping one slot device with another."
This reverts commit 9968fc71b0.

This hides the underlying problem that the options structure is getting
out-of-sync.  It's losing the image option but not the underlying
option.  Masking the problem doesn't fix it.
2017-08-06 21:47:53 +10:00
Robbbert
9968fc71b0 (nw) Fixed random crashing when swapping one slot device with another. 2017-08-06 21:01:11 +10:00
Nathan Woods
281223e497 Cleanup/bulletproofing to the issue Wizz just found 2017-07-24 01:52:21 +10:00
Robbbert
976a3724e2 (nw) Save partname to inifile, so that the correct part is loaded next time. 2017-07-24 01:33:38 +10:00
Vas Crabb
d18aa3e097 never hurts to srcclean (nw) 2017-07-09 03:21:32 +10:00
Nathan Woods
d7e81e1e57 Fixed sorcerer unmount issue reported by Robert
Report from Robert:

Start mame sorcerer, then enter the slots menu, empty the rs232 slot, then choose Reset. It crashes with an access violation.
2017-06-30 10:09:05 +10:00
Nathan Woods
ad3191cdd3 Fixed issue loading reset_on_load() images (#2414) 2017-06-27 16:20:45 +10:00
Vas Crabb
fb61e98cc5 more srcclean (nw) 2017-06-25 15:21:44 +10:00
npwoods
b193e05cd7 Overhaul to how MAME handles options, take two (#2341) 2017-06-25 12:48:56 +10:00
Robbbert
7346e19dfa Fixed 2 bugs
1. If either a multipart softlist item was loaded, or a single-part item loaded into a system with more than one of the same media slot, then a reset would cause a fatal error.
2. If a non-existing image was listed in the ini, it would fatal error at start and there was no way to fix it except by hand-editing the ini file. This restores the previous behaviour of ejecting the bad image with the first error.
2017-05-25 23:58:51 +10:00
Vas Crabb
a400c011a9 Revert "Overhaul to how MAME handles options (#2260)"
This reverts commit 536990e77b.

Conflicts:
	src/frontend/mame/mame.cpp

Sorry, but this change was half-baked.  It breaks a lot of existing
functionality and clearly hasn't been tested in more than a tiny subset
of use cases.  Please play this work back onto your own branch, and test
it before submitting another PR.
2017-05-07 14:40:12 +10:00
npwoods
536990e77b Overhaul to how MAME handles options (#2260)
This is an overhaul to how MAME handles options to provide a better foundation for what MAME is already doing in practice. Previously, core_options was designed to provide an input/output facility for reading options from the command line and INI files. However, the current needs (image/slot/get_default_card_software calculus and MewUI) go way beyond that.

Broadly, this PR makes the following changes:
* core_options now has an extensibility mechanism, so one can register options that behave dramatically differently
* With that foundation, emu_options now encapsulates all of the funky image/slot/get_default_card_software calculus that were previously handled by static methods in mameopts.cpp. Changes to emu_options should not automatically cascade in such a way so that it stays in a consistent state
* emu_options no longer provides direct access to the slot_options/image_options maps; there are simpler API functions that control these capabilities
* Many core_options functions that expose internal data structures (e.g. - priority) that were only really needed because of previous (now obsolete) techniques have been removed.
* core_options is now exception based (rather than dumping text to an std::string). The burden is on the caller to catch these, and discern between warnings and errors as needed.

Obviously this is a risky change; that's why this is being submitted at the start of the dev cycle.
2017-05-05 16:17:49 +10:00
npwoods
532f4ec861 Workaround for issue where the cannonical instance_name for a device was lost (#2248)
This is a hack; details are in the source code.  I felt that it was too late in the 0.185 release cycle to do anything intrusive.  I intend to fix this "for real" when image/slot option morphing is encapsulated within emu_options.
2017-04-21 18:55:28 +02:00
npwoods
fb7dd27728 Fixed an issue where reset_on_load images would not properly persist across emulation sessions (#2244) 2017-04-19 14:19:17 +02:00
Nathan Woods
c108986639 More options refactoring
This should address outstanding concerns with PR#2231.  I'm trying to turn emu_options into a self contained structure that encapsulates behaviors related to options, including the gymnastics pertaining to image/slot loading and interactions with get_default_card_software() and "just works".

When the MAME 0.186 development cycle starts up, I hope to take this further.  I want to make core_options::entry an abstract base class so that the entries associated with image options and slot options can derive from it.  This will eliminate the current need for emu_options to directly expose maps for image and slot options.

For now, I'm in stabilization mode, and I hope to get things working for a stable 0.185 release.
2017-04-16 13:08:57 -04:00
Nathan Woods
fbb7d927d3 Refactoring in response to MT#6531
Prior to this change, options for images and slots were stored in the emu_options collection.  Anything that might restart the emulation (such as slot changes and images that reset on load) had to manipulate the emu_options structure directly.  The dynamic nature of images and slots meant that some elaborate conventions for setting up this collection had to be understood by clients.

After this change, emu_options has two new members (image_options and slot_options) that expose image and slot selections via an std::map.  Anything that changes images or slots in a fashion that needs to persist across sessions needs to modify these data structures.  Additionally, some of the hairly logic (e.g. - get_default_card_software) now records its data here rather than trying to subvert the core_options system.

This is how MT#6531 was fixed; now when diimage.cpp sees an image that resets on load, it just modifies the image_options structure and forces a reset.  This allowed some further cleanups to happen within diimage.

This should be considered a very risky change, and scrutiny/feedback is welcome.  In particular, there seems to be functionality surrounding device bioses that I'm not 100% sure how it works; the syntax seems to imply that it only works on slot devices.
2017-04-06 11:20:45 +10:00
npwoods
a011e3a22e Changed a few more 'const char *' ==> 'const std::string &' (#2111) 2017-03-04 16:00:18 -05:00
Vas Crabb
c8f1954467 XML refactoring:
* move stuff to namespace util::xml
* scope down some enums
* split config load/save delegate types
* make config load take const so it can't mangle data
2016-12-11 18:15:41 +11:00
Vas Crabb
2354a42010 Turn xmlfile API into something that looks like C++
It's still a bit quirky but it's far better encapsulated before, and it plays nice with const (nw)
2016-11-17 01:44:03 +11:00
Miodrag Milanovic
2027d59e7f Do not use FUNC in delegate where applicable (nw) 2016-11-06 14:11:55 +01:00
Nathan Woods
98df223c17 Allows devices to indicate whether image creation should be supported at the command line
This addresses MT bug #6372.  The prior issue is that creating serial and/or printer output relied on how image_load() would create images that were not there.  This behavior was not universally desirable (the consensus was that it was wrong for disk images, up in the air for cassettes etc).  This change makes it possible for devices to control this behavior.

Currently I have it associated with image_type(); this might not be the ideal fix.
2016-09-06 07:37:31 -04:00
Nathan Woods
9f5325a311 device_image_interface::software_name_split() ==> softlist.cpp:software_name_parse()
Also consolidated with code that performed a quick pass to identify whether a piece of text is a software name
2016-08-10 07:22:46 -04:00
AJR
f9939f28a8 UI-related cleanup (nw)
- Create class ui::machine_info for holding calculated machine info and generating descriptive strings for the UI. This absorbs a number of unimportant core functions that existed only for the UI's convenience.
2016-08-09 20:31:34 -04:00
Nathan Woods
ff064ba37a More conversion of 'const char *' --> std::string in diimage 2016-08-04 07:21:27 -04:00
Nathan Woods
af967d1ee7 Fixed issue that prevented softlist items specified on devices from loading
The issue is that I expected any softlist items passed to devices to be fully qualified (e.g. - apple2e:flop1:agentusa) when in reality, they might not be.  Therefore, I changed the regex that identifies softlist items passed to devices from:

	\\w+\\:\\w+\\:\\w+

to:

	\\w+(\\:\\w+\\:\\w+)?
2016-08-01 23:16:46 -04:00
Nathan Woods
764371c72c Changed device_image_interface::load() to take 'const std::string &' 2016-08-01 19:44:01 -04:00
Vas Crabb
15e7be7ac8 Turn image init/validate into scoped enums to avoid accidental casts to/from integer and boolean types
The image error should also be turned into a scoped enum - the menus were assuming it was the same thing as an init result
2016-08-01 18:47:22 +10:00
Nathan Woods
81c8de57ca Changed device_image_interface::load() so that it is no longer responsible for both loading images and softlist items; now the latter
is done through a new method - device_image_interface::load_software()
2016-07-30 10:59:54 -04:00
Miodrag Milanovic
1c726824f2 Split UI and frontend part from core [Miodrag Milanovic] 2016-04-23 11:26:47 +02:00
AJR
084d3654ca Iterate over devices C++11 style
Replace the old device_iterator and its specialized versions with functionally equivalent classes that use standard operators to yield references to devices/interfaces rather than pointers. With range-based for loops, they no longer have to be stored in named variables, though they can also be reused concurrently since the iteration state is now maintained by a subclass.

Add a few more typical getters to device_t::subdevice_list.
2016-04-18 18:53:28 -04:00
etabeta78
c1600cafd9 diimage.cpp: Allow image devices to be configured with a fixed
(not user selectable) piece of software and updated a few options
and menu to acknowledge such possibility. [Fabio Priuli]

macs.cpp: Converted to use generic cartslot with fixed software
configuration. Cleaned up loading and banking systems in the driver
as a result. [Fabio Priuli]
2016-04-12 14:37:22 +02:00
Vas Crabb
42fbb9c396 Make osd_file a polymorphic class that's held with smart pointers
Make avi_file a class that's held with smart pointers, encapsulate various AVI I/O structures
Make zip_file and _7z_file classes rather than having free functions everywhere
Hide zip/7z class implementation behind an interface, no longer need to call close() to send back to the cache
Don't dump as much crap in global namespace
Add solaris PTY implementation
Improve variable expansion for SDL OSD - supports ~/$FOO/${BAR} syntax
Rearrange stuff so the same things are in file module for all OSDs
Move file stuff into its own module

7z/zip open and destruct are still not thread-safe due to lack of interlocks around cache access
Directory functions still need to be moved to file module
SDL OSD may not initialise WinSock on Windows
2016-03-14 18:55:00 +11:00
Miodrag Milanovic
b1d6f6d63f Cleanups and version bump 2016-01-27 08:12:00 +01:00
Miodrag Milanovic
7c9cd3feea Revert "rest of device parameters to std::string (nw)"
This reverts commit caba131d84.
2016-01-20 21:35:11 +01:00
Miodrag Milanovic
caba131d84 rest of device parameters to std::string (nw) 2016-01-16 20:05:32 +01:00
Miodrag Milanovic
7f02a9e47b Fix image unload (nw) 2016-01-14 14:10:36 +01:00
Miodrag Milanovic
f0dc809ab8 image_manager modernized and move some things around (nw) 2016-01-11 14:59:24 +01:00
Miodrag Milanović
36195292e3 Merge pull request #561 from ajrhacker/strings
Return std::string objects by value rather than pass by reference [ajrhacker]
2016-01-11 09:18:43 +01:00
AJR
115db95642 Return std::string objects by value rather than pass by reference
- strprintf is unaltered, but strformat now takes one fewer argument
- state_string_export still fills a buffer, but has been made const
- get_default_card_software now takes no arguments but returns a string
2016-01-10 16:36:18 -05:00
Miodrag Milanovic
3e5ad46410 modernized configuration_manager (nw) 2016-01-10 15:17:18 +01:00
Miodrag Milanovic
91605d3f4d clang-modernize part 1 (nw) 2015-12-03 18:17:25 +01:00
Miodrag Milanovic
7c19aac60e Rename *.c -> *.cpp in our source (nw) 2015-11-08 12:56:12 +01:00