summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/image.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Various cleanups: Vas Crabb2024-05-311-13/+11
| | | | | | * tools/aueffectutil.mm: Fixed more deprecation warnings. * Got rid of some sprintf and strcat (generates warnings on macOS). * cpu/mipsx: Got stuff out of headers that shouldn't be there.
* -emu/devcb.h: Removed set_log and append_log. Vas Crabb2023-08-021-0/+9
| | | | | | | | | * These helpers were unintuitive and inflexible. In particular, set_log on a write handler would only log when the value is non-zero, which doesn't appear to be the desired behaviour for several uses. -util/options.cpp: Always leave a space between option and description in usage messages (fixes GitHub #11438).
* image: Fix initialisation order, fix file menu enable, refine gdrom support Olivier Galibert2023-05-081-0/+3
|
* Restored ability of for image devices to report specific error messages. Vas Crabb2023-04-081-13/+17
| | | | | | | | | | | | | | Restores ability to give specific/detailed messages removed in 6f7e4141ea14acaaf9cb973c66788fabb3457023 while pandering to obsession with single return value. Moved responsibility for displaying the error message in the UI to the caller rather than device_image_interface, and made device_image_interface always log the error along with the full path and error condition content. Gave several image devices more detailed error messages. Added some FIXME comments for apparent bugs.
* API change for device_image_interface AJR2023-03-301-8/+8
| | | | | | | | | - Remove the seterror method for recording error messages and conditions. Condition codes have been made return values for call_load, call_create and various related callbacks. Error messages (which many devices weren't generating) are now displayed through osd_printf_error. - Eliminate the image_init_result and image_verify_result pass/fail enumeration types. Update many functions that were returning these enumerations or simply bools to return std::error_condition instead. In some cases, this type is now passed down from internal parsing/loading functions which were already returning it. In various other cases, the former default UNSPECIFIED has been used as a catchall for I/O errors; anticipated future refactorings should make these error returns more specific. - Expand the image_error categories to include INVALIDLENGTH, NOSOFTWARE and BADSOFTWARE. The first is largely self-explanatory. The second is generated by the core to indicate failure to find software items in lists. The third is provided for devices to indicate semantic errors in software list entries. - Change the return type of floppy_image_device::identify to a pair so the potential error condition can be passed along to the UI without storing it in a member variable. - Move device_image_interface::message down into snapshot_image_device and change its implementation to use string_format instead of printf. - Correct a typo in the shortname of the generic snapshot device.
* Various input and OSD refactoring: Vas Crabb2023-01-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | osd: Supply OSD object to modules on initialisation. Encapsulated some event handling in the OSD objects rather than leaving it in free functions. Put various stuff in namespaces. osd/modules/input: Enabled dinput, xinput and winhybrid modules for Windows SDL builds, and enabled background input for dinput and xinput (and by extension winhybrid) modules. Also fixed some COM and X11 resource leaks. osd/modules/input/input_sdl.cpp: Flipped SDL mouse button order to match Windows, and exposed vertical and horizontal scroll as Z and rZ axes. Moved SDL UI event handling out of input devices into OSD object. osd/modules/input_rawinput.cpp: Changed lightgun Z axis token so it's correctly identified as a relative axis (it maps to the scroll wheel equivalent). osd: Added an option to choose the network provider module. Mostly useful if you build with both TUN/TAP and pcap support included, or if you want to disable emulated networking completely. emu/input.cpp: Use a better strategy for assembling input code names that uses fewer temporary strings and doesn't require use of the non-Unicode-aware space trimming function (fixes MT08552). osd/modules/input_dinput.cpp: Improved polling logic. osd: Made various parts of the input code less dependent on concrete emu objects, and reduced inappropriately passing around the machine object. Made input modules less dependent on OSD implementation. Encapsulated some stuff and got rid of some vestigial newui and SDL1 support code. Cleaned up some interfaces. Moved OSD options classes to their own files. Prepare to remove main.h from emu.h - it's mostly used to get the application name, which the vast majority of emulated devices don't need to do.
* Remove fileio.h from emu.h AJR2022-02-111-0/+1
|
* util: Further API cleanups: (#8661) Vas Crabb2021-10-051-1/+1
| | | | | * Turned `core_file` into an implementation of `random_read_write`. * Turned PNG errors into a standard error category. * Added a helper for generating what look like derived classes on-the-fly.
* formats, osd, util: Started refactoring file I/O stuff. (#8456) Vas Crabb2021-08-221-2/+2
| | | | | | | | | Added more modern generic I/O interfaces with implementation backed by stdio, osd_file and core_file, replacing io_generic. Also replaced core_file's build-in zlib compression with a filter. unzip.cpp, un7z.cpp: Added option to supply abstract I/O interface rather than filename. Converted osd_file, core_file, archive_file, chd_file and device_image_interface to use std::error_condition rather than their own error enums. Allow mounting TI-99 RPK from inside archives.
* API cleanups and miscellaneous fixes. Vas Crabb2021-07-151-5/+8
| | | | | | | | | | | | | | | | emu/ioport.cpp: Allow controller files to override input sequences for inputs that don't use defaults, and to override the toggle setting for digital inputs. emu/config.cpp: Expose configuration level (mostly matters for controller files), improved verbose diagnostic messages, and moved a few things out of the global and preprocessor namespaces. docs: Added documentation for some controller configuration file features. The device mapping feature documentation will be merged in at some point. util/unicode.cpp, emu/input.cpp: API cleanups.
* -osd/windows: Minimise full-screen windows on losing focus (#2997). Vas Crabb2021-01-211-2/+2
| | | | | | | | -osd/modules/osdwindow.cpp: Clean up window title formatting. * Show data type model in window title. * Moved window title formatting to a single place. -tools/chdman.cpp: Removed some unnecessary .c_str() calls.
* Much more core std::string_view modernization AJR2021-01-201-4/+91
| | | | | | | | | | | | | | | - Remove corestr.h from emu.h; update a few source files to not use it at all - Change strtrimspace, strtrimrightspace and core_filename_extract_* to be pure functions taking a std::string_view by value and returning the same type - Change strmakeupper and strmakelower to be pure functions taking a std::string_view and constructing a std::string - Remove the string-modifying version of zippath_parent - Change tag-based lookup functions in device_t to take std::string_view instead of const std::string & or const char * - Remove the subdevice tag cache from device_t (since device finders are now recommended) and replace it with a map covering directly owned subdevices only - Move the working directory setup method out of device_image_interface (only the UI seems to actually use the full version of this) - Change output_manager to use std::string_view for output name arguments - Change core_options to accept std::string_view for most name and value arguments (return values are still C strings for now) - Change miscellaneous other functions to accept std::string_view arguments - Remove a few string accessor macros from romload.h - Remove many unnecessary c_str() calls from logging/error messages
* Further additions of std::string_view AJR2021-01-011-1/+1
| | | | | | | - corefile.cpp, fileio.cpp: Change puts to take a std::string_view parameter - rendlay.cpp: Use std::string_view instead of bare pointers in various functions - vecstream.h: Add std::string_view conversion operator to obtain output buffer without needing to make it a C string with explicit null termination - xmlfile.cpp: Add get_attribute_string_ptr method that distinguishes between empty strings and absent attributes without falling back to C strings
* Fairly significant overhaul of Lua engine and some cleanup. Vas Crabb2020-11-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The things that were previously called device iterators are not iterators in the C++ sense of the word. This is confusing for newcomers. These have been renamed to be device enumerators. Several Lua methods and properties that previously returned tables now return lightweight wrappers for the underlying objects. This means creating them is a lot faster, but you can't modify them, and the performance characteristics of different operations varies. The render manager's target list uses 1-based indexing to be more like idiomatic Lua. It's now possible to create a device enumerator on any device, and then get subdevices (or sibling devices) using a relative tag. Much more render/layout functionality has been exposed to Lua. Layout scripts now have access to the layout file and can directly set the state of an item with no bindings, or register callbacks to obtain state. Some things that were previously methods are now read-only properties. Layout files are no longer required to supply a "name". This was problematic because the same layout file could be loaded for multiple instances of the same device, and each instance of the layout file should use the correct inputs (and in the future outputs) for the device instance it's associated with. This should also fix video output with MSVC builds by avoiding delegates that return things that don't fit in a register.
* emu: correct some file headers (nw) hap2020-06-191-1/+0
|
* use C++ library includes (nw) firewave2020-01-221-1/+1
|
* Spring cleaning: Vas Crabb2019-11-011-8/+8
| | | | | | | | | | | | * Changed emu_fatalerror to use util::string_format semantics * Fixed some incorrectly marked up stuff in build scripts * Make internal layout compression type a scoped enum (only zlib is supported still, but at least the values aren't magic numbers now) * Fixed memory leaks in Xbox USB * There can only be one "perfect quantum" device - enforce that only the root machine can set it, as allowing subdevices to will cause weird issues with slot cards overiding it * Allow multiple devices to set maximum quantum and use the most restrictive one (it's maximum quantum, it would be minimum interleave) * Got rid of device_slot_card_interface as it wasn't providing value * Added a helper template to reduce certain kinds of boilerplate in slots/buses * Cleaned up some particularly bad slot code (plenty more of that to do), and made some slots more idiomatic
* Fix segfault when trying to access some image option that does not exists ↵ AmatCoder2019-07-181-2/+3
| | | | | | | | (#5352) * emuopts.h: Add method to check if image option exists * image.cpp: Avoid to require image_option if it does not exists
* Include option and file names in fatal error message for failure to load image AJR2018-03-221-2/+4
|
* Revert "(nw) Fixed random crashing when swapping one slot device with another." Vas Crabb2017-08-061-1/+1
| | | | | | | | This reverts commit 9968fc71b08b2a27e930d02333cb813977a37cbd. 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.
* (nw) Fixed random crashing when swapping one slot device with another. Robbbert2017-08-061-1/+1
|
* Cleanup/bulletproofing to the issue Wizz just found Nathan Woods2017-07-241-8/+5
|
* (nw) Save partname to inifile, so that the correct part is loaded next time. Robbbert2017-07-241-0/+5
|
* never hurts to srcclean (nw) Vas Crabb2017-07-091-2/+2
|
* Fixed sorcerer unmount issue reported by Robert Nathan Woods2017-06-301-2/+3
| | | | | | Report from Robert: Start mame sorcerer, then enter the slots menu, empty the rs232 slot, then choose Reset. It crashes with an access violation.
* Fixed issue loading reset_on_load() images (#2414) Nathan Woods2017-06-271-2/+5
|
* more srcclean (nw) Vas Crabb2017-06-251-4/+4
|
* Overhaul to how MAME handles options, take two (#2341) npwoods2017-06-251-32/+13
|
* Fixed 2 bugs Robbbert2017-05-251-3/+8
| | | | | 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.
* Revert "Overhaul to how MAME handles options (#2260)" Vas Crabb2017-05-071-3/+28
| | | | | | | | | | | | This reverts commit 536990e77b49ccc50ef275bfbf1018cc29c16154. 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.
* Overhaul to how MAME handles options (#2260) npwoods2017-05-051-28/+3
| | | | | | | | | | | | 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.
* Workaround for issue where the cannonical instance_name for a device was ↵ npwoods2017-04-211-1/+27
| | | | | 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.
* Fixed an issue where reset_on_load images would not properly persist across ↵ npwoods2017-04-191-10/+15
| | | | emulation sessions (#2244)
* More options refactoring Nathan Woods2017-04-161-15/+15
| | | | | | | | 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.
* Refactoring in response to MT#6531 Nathan Woods2017-04-061-12/+9
| | | | | | | | | | 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.
* Changed a few more 'const char *' ==> 'const std::string &' (#2111) npwoods2017-03-041-4/+4
|
* XML refactoring: Vas Crabb2016-12-111-18/+12
| | | | | | | * 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
* Turn xmlfile API into something that looks like C++ Vas Crabb2016-11-171-7/+7
| | | | It's still a bit quirky but it's far better encapsulated before, and it plays nice with const (nw)
* Do not use FUNC in delegate where applicable (nw) Miodrag Milanovic2016-11-061-2/+2
|
* Allows devices to indicate whether image creation should be supported at the ↵ Nathan Woods2016-09-061-0/+4
| | | | | | | | 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.
* device_image_interface::software_name_split() ==> ↵ Nathan Woods2016-08-101-8/+2
| | | | | | 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
* UI-related cleanup (nw) AJR2016-08-091-17/+0
| | | | - 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.
* More conversion of 'const char *' --> std::string in diimage Nathan Woods2016-08-041-1/+1
|
* Fixed issue that prevented softlist items specified on devices from loading Nathan Woods2016-08-011-7/+8
| | | | | | | | | | 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+)?
* Changed device_image_interface::load() to take 'const std::string &' Nathan Woods2016-08-011-1/+1
|
* Turn image init/validate into scoped enums to avoid accidental casts to/from ↵ Vas Crabb2016-08-011-4/+4
| | | | | | 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
* Changed device_image_interface::load() so that it is no longer responsible ↵ Nathan Woods2016-07-301-13/+29
| | | | | | for both loading images and softlist items; now the latter is done through a new method - device_image_interface::load_software()
* Split UI and frontend part from core [Miodrag Milanovic] Miodrag Milanovic2016-04-231-2/+2
|
* Iterate over devices C++11 style AJR2016-04-181-45/+35
| | | | | | 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.
* diimage.cpp: Allow image devices to be configured with a fixed etabeta782016-04-121-0/+4
| | | | | | | | | (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]