summaryrefslogtreecommitdiffstats
path: root/src/emu/render.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Revert "Remove fileio.h from emu.h"" Robbbert2022-03-151-0/+1
| | | | This reverts commit ea6d1ae3f4cd36732c2b9a2a6d02a06dc4a97def.
* Revert "Remove fileio.h from emu.h" Robbbert2022-02-131-1/+0
| | | | This reverts commit 0cb0cfd4c66915b43929d496fb694445fd7ab6ea.
* Remove fileio.h from emu.h AJR2022-02-111-0/+1
|
* rendutil.cpp: API cleanup + minor related OSD render cleanups AJR2022-01-221-6/+6
|
* emu/render.cpp: Improved scale factor selection. (#8961) antonioginer2022-01-061-41/+81
| | | Fixes aspect related issues, undesired overscan, etc. (GitHub #8209, GitHub #8387, MT08110)
* -emu/render.cpp: Get the initial view check off the hot path (fixes MT08159). Vas Crabb2021-12-241-11/+27
| | | | -Tidied up a few things, reduced bloat in a few more slots layouts.
* render.cpp: Use simple_list instead of std::list for containers; remove old ↵ AJR2021-11-211-101/+34
| | | | remnants of "internal" debugger
* -emu/render.cpp: Fixed texture size calculation for oblong items. Vas Crabb2021-11-191-4/+4
| | | | -bfm_sc2.cpp: Removed reel components from sc2prem2 layout.
* emu/render.cpp, emu/rendlay.cpp: Added scroll support for all elements. Vas Crabb2021-11-181-21/+64
|
* -frontend: Refactored menu event handling and fixed a number of issues. (#8777) Vas Crabb2021-10-311-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Moved common code for drawing about box, info viewer, and other text box menus to a base class; removed the last of the info viewer logic and the multi-line item hack from the base menu class. * Added previous/next group navigation for general inputs and plugin input selection menus. * Moved message catalog logic to lib/util, allowing osd and emu to use localised messages. * Made the base menu class use the UI manager’s feature for holding session state rather than a static map and mutex. * Improved menu event handling model, and fixed many issues, particularly with menus behaving badly when hidden/shown. * Added better support for menus that don’t participate in the usual menu stack, like the menuless sliders and the save/load state menus. * Made a number of menus refresh state when being shown after being hidden (fixes MT08121 among other issues). * Fixed indication of mounted slot option in the slot option details menu. * Improved appearance of background menus when emulation isn't running - draw all menus in the stack, and darken the background menus to make the edges of the active menu clearer. * Fixed locale issues in -listxml. -debugger: Made GUI debuggers more uniform. * Added new memory view features to Win32 debugger. * Fixed spelling of hexadecimal in Cocoa debugger and added decimal address option. * Fixed duplicate keyboard shortcut in Cocoa debugger (Shift-Cmd-D was both new device window and 64-bit float format). * Made keyboard shortcuts slightly more consistent across debuggers. -plugins: Moved input selection menu and sequence polling code to a common library. Fixed the issue that prevented keyboard inputs being mapped with -steadykey on. -docs: Started adding some documentation for MAME's internal UI, and updated the list of example front-ends. -Regenerated message catalog sources. For translators, the new strings are mostly: * The names of the inputs provided by the OS-dependent layer for things like fullscreen and video features. These show up in the user interface inputs menu. * The names for automatically generated views. These show up in the video options menu - test with a system with a lot of screens to see more variants. * The input macro plugin UI. * A few format strings for analog input assignments. * A few strings for the about box header.
* More miscellaneous cleanup: Vas Crabb2021-08-301-39/+36
| | | | | | | | | | | | | emu/render.cpp: Use I/O filter for zlib decompression, avoiding the need to use zlib directly. audo/bally.cpp: Moved several constructors out of the header, fixed a save state issue, and made outputs use finders. exidy.cpp: Split up state class and reduced reliance on driver init functions. Changed various drivers to use output finders.
* formats, osd, util: Started refactoring file I/O stuff. (#8456) Vas Crabb2021-08-221-2/+3
| | | | | | | | | 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.
* emu/render.cpp: Fixed automatic sizing of snapshots/recordings. (#8397) antonioginer2021-08-061-13/+22
| | | This fixes bad scaling on snapshots and recording when using -uesx and forced scale factors.
* API cleanups and miscellaneous fixes. Vas Crabb2021-07-151-6/+9
| | | | | | | | | | | | | | | | 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.
* Correctly apply -keepaspect with -unevenstretchx/y. (#8209) antonioginer2021-07-021-17/+35
| | | | * Correctly apply -keepaspect with -unevenstretchx/y. Initialize window at the correct size when -intscalex/y is used. * Get correct window size upon maximizing/minimizing with integer scaling.
* Eliminate ARRAY_LENGTH template in favor of C++17's std::size AJR2021-02-141-5/+5
| | | | | | | | | | * osdcomm.h: Move definition of EQUIVALENT_ARRAY to coretmpl.h * sharc.cpp, gt64xxx.cpp, ym2413.cpp, gb_lcd.cpp, snes_ppu.cpp: Use STRUCT_MEMBER for save state registration * gio/newport.cpp, megadrive/svp.cpp, nes_ctrl/bcbattle.cpp, arm7.cpp, tms9995.cpp, pckeybrd.cpp, sa1110.cpp, sa1111.cpp, jangou_blitter.cpp, vic4567.cpp: Use std::fill(_n) instead of memset * emucore.h: Remove obsolete typedef
* Use std::clamp in various core functions AJR2021-02-031-2/+2
|
* Much more core std::string_view modernization AJR2021-01-201-0/+1
| | | | | | | | | | | | | | | - 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
* render.h, rendlay.h: Dependency refactoring AJR2021-01-041-25/+22
| | | | | - render.h: Split out layout class declarations into rendlay.h, with some adjustments for the resulting incomplete types (std::reference_wrapper unfortunately does not allow these by C++17 rules) - rendlay.h: Move old header contents to layout/generic.h
* Fix some oversights and emergent behaviour with view selection. Vas Crabb2020-12-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Exposed the "native snapview" option on the video manager. Trying to use presence of a single view is a poor proxy that breaks with multi-screen systems. Allow rotation to be changed for native snapshot views, and disable the zoom to screen area control when it has no effect on the selected view. Treat an empty string identically to "auto" for view selectction. Previously this was being used for prefix matching so it would force the first view. (This caused the bad snapshot view selection. It had been relying on "internal" not being a common view name prefix so it fell through to automatic selection, but when changed to an empty string it forced the first view.) Documented "auto" as well as "native" for the -snapview option and changed the default to auto rather than an empty string for consistency with the -viewN options. Added [w]string_view handlers to the stuff that's instantiated in strformat.cpp since we'll be increasingly using them. Cleaned up and updated some documentation.
* More Lua engine clean-up and documentation, resulting in core cleanup. Vas Crabb2020-12-181-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More Lua interface cleanup, additional properties and methods, and documentation migration/expansion. Emulated switch inputs can have "not" codes applied to host input axis directions. It works the same way as host switch inputs - push twice for a "not" prefix. Input polling helpers no longer need to store state in the input device items. There’s less leakage, and less chance of things interfering with each other. Allow snapshot view options to be configured through the internal UI via the video options menu. Made video options menus place initial focus on the currently selected view item. Removed some crud from the menu base class. Fixed the description of the "snapview" option. The value to get raw screen pixels was changed to "native" a long time ago but the description was never updated. Re-arranged the Golden Poker button lamps so that the 6-button layouts for Jolli Witch and Wild Witch make sense. In 6-button mode, the hold buttons double as bonus game and bet buttons, but the lamp outputs don't change. The simplest way to deal with this without requiring the user to switch views or using layout scripting is to place the dedicated buttons directly below the hold buttons that correspond to them. Removed some software list data that was redundantly copied into device_image_interface (m_supported was never even set, so it didn't even work), and made crc() work better (previously it wasn't recalculuated after unloading and loading another image). Made strformat.h and devcb.h play nicer with C++17 and pre-standard C++20. Format precision now correctly limits the length of string views. Confirmed that strformat.{h,cpp} works with pre-standard C++20 support in GCC 9. Removed an auto_alloc from cpu/arm7.
* -luaengine.cpp: Clean up render classes and expose screen image adjustments. Vas Crabb2020-12-131-7/+3
| | | | | | | | | | | | | | | | | | | | | * Started moving Lua class reference to docs. Expecting people to find the class reference material in the source isn’t going to help make it approachable. The docs allow longer explanations, better formatting, and cross reference links. * Added another layout scripting example to the docs. -goldnpkr.cpp: Minor clean-up. * Improved the short names for Witch Card and Witch Game clone sets. * Made Witch Up & Down artwork clickable. * Added working Video Klein sets where the parent is a working Video Klein set to the tiny subtarget. * Removed history from the header comment - we have version control for a readon.
* Expose enough of the layout system to Lua to allow position and colour to be ↵ Vas Crabb2020-12-051-0/+1
| | | | animated.
* Fairly significant overhaul of Lua engine and some cleanup. Vas Crabb2020-11-251-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* -unidasm: Allow input piped from stdin by specifying a bare hyphen as the ↵ Vas Crabb2020-11-181-1/+1
| | | | | | | | | | filename. [AJR, Vas Crabb] -netlist: Give devices the C++17 namespace treatment. -Tidied up compiler warning options for 3rdparty. -emu/render.cpp: Exposed a few information view item properties.
* rendlay.cpp: Set initial value for bounds callback, it can be called before ↵ Vas Crabb2020-11-131-2/+2
| | | | tags are resolved.
* -render.cpp: Fixed issue causing elements to be clipped on bottom/right. Vas Crabb2020-10-141-9/+3
| | | | | | -rendlay.cpp: Tidied up and optimised ellipse drawing code a little. -Reduced space between LEDs on several systems with matrix displays.
* -emu/render.cpp: Load from all external artwork paths. Vas Crabb2020-10-131-38/+36
| | | | | | -emu/rendlay.cpp: Made real component drawing code a bit less gross. -emu/debugcon.cpp: Less screaming now that things aren't macros.
* Various improvements to image file handling: Vas Crabb2020-10-081-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | Moved MS DIB parser out of ICO file reader and made it available for artwork and layout images. Added more efficient I/O and better error checking for JPEG file loading (MAME will no longer exit immediately on a bad JPEG file). Made caller responsible for opening files for loading images, to avoid decompressing images used in ZIP/7z artwork multiple times. Added support for JPEG and Windows DIB to picture_image_device. Added support for SVG image files in external artwork. Added support for using I/O port value for animation state and masking animation state values. Made bounds elements more flexible in layouts. Reworked headers to reduce dependencies. Updated layout file format documentation.
* -emu/rendlay.cpp: Allow item animation. Vas Crabb2020-10-051-17/+19
| | | | -cgang.cpp: Make internal artwork more fun.
* emu/rendlay.cpp: Pre-load image components when changing video options. Vas Crabb2020-10-031-27/+32
|
* emu/render.cpp: Consider that screens can be hidden when choosing a default ↵ Vas Crabb2020-10-031-18/+15
| | | | view.
* Got rid of global_alloc/global_free. Vas Crabb2020-10-031-36/+22
| | | | | | | | | | | | | | | | | | | | | | | | | The global_alloc/global_free functions have outlived their usefulness. They don't allow consistently overriding the default memory allocation behaviour because they aren't used consistently, and we don't have standard library allocator wrappers for them that we'd need to use them consistently with all the standard library containers we're using. If you need to change the default allocator behaviour, you can override the new/delete operators, and there are ways to get more fine-grained control that way. We're already doing that to pre-fill memory in debug builds. Code was already starting to depend on global_alloc/global_free wrapping new/delete. For example some parts of the code (including the UI and Windows debugger) was putting the result of global_alloc in a std::unique_ptr wrappers without custom deleters, and the SPU sound device was assuming it could use global_free to release memory allocated with operator new. There was also code misunderstanding the behaviour of global_alloc, for example the GROM port cartridge code was checking for nullptr when a failure will actually throw std::bad_alloc. As well as substituting new/delete, I've made several things use smart pointers to reduce the chance of leaks, and fixed a couple of leaks, too.
* Cleaned up bitmap API. Vas Crabb2020-09-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Made const-qualified pixel accessors (pix, pixt, raw_pixptr) return const-qualified references/pointers to pixesl, and added non-const versions. This makes bitmap more like standard library containers where const protects the content as well as the dimensions. Made the templated pixt accessor protected - having it public makes it too easy to inadvertently get a pointer to the wrong location. Removed the pix(8|16|32|64) accessors from the specific bitmaps. You could only use the "correct" one anyway, and having the "incorrect" ones available prevented explicit instantiations of the class template because the static assertions would fail. You can still see the pixel type in the bitmap class names, and you can't assign the result of &pix(y, x) to the wrong kind of pointer without a cast. Added fill member functions to the specific bitmap template, and added a explicit instantiations. This allows the bitmap size check to be skipped on most bitmap fills, although the clipping check is still there. Also fixed a couple of places that were trying to fill an indexed 16-bit bitmap with rgb_t::black() exposed by this (replaced with zero to get the same net effect). The explicit template instantiations in the .cpp file mean the compiler can inline the function if necessary, but don't need to generate a local out-of-line body if it chooses not to. Extended the size of the fill value parameter in the base bitmap class to 64 bits so it works correctly for 64-bit bitmaps. Fixed places where IE15 and VGM visualiser weren't accounting for row bytes potentially being larger than width. Fixed an off-by-one in an HP-DIO card where it was treating the Topcat cursor right edge as exclusive. Updated everything to work with the API changes, reduced the scope of many variables, added more const, and replaced a few fill/copy loops with stuff from <algorithm>.
* emu/rendlay.cpp: Added parameter animation and state masks. Vas Crabb2020-09-161-4/+2
| | | | | | | | | | | | | | | | | | | Components may have multiple bounds and/or color child elements with state attributes, allowing for piecewise linear position/size/colour animation. Components may have a statemask attribute, allowing for things like using external images to draw a multi-segment LED/VFD display without requiring dozens of outputs for the individual lines or thousands of images for all possible states. (Texture caching still never releases anything, so MAME can still exceed the maximum number of textures, but that’s a separate issue.) Image components with alpha now blend over previously drawn components. Layouts have been changed to use yes/no for inputraw to match what's used for flipx/flipy. External layouts with 1/0 will still work, but complay.py will complain.
* emu/render.cpp: Apply target orientation when mapping points to layout elements. Vas Crabb2020-09-121-76/+115
| | | | | | | | | Addresses MT07375. Also increase efficiency when layouts contain large numbers of non-interactive elements (e.g. thousands of matrix display dots). Also includes work in progress for future improvements.
* -Fixed issue that automatically generated unnecessary internal views. Vas Crabb2020-09-071-2/+13
| | | | | | | -Updated a few more internal layouts, mostly bezel-only ones. * brkball wasn't using the DMD dots at all (it has a screen). * The Aristocrat layouts could use collections to allow buttons and tower lamps to be enabled/disabled independently.
* Finished adding new mechanism for allowing parts of views to be hidden. Vas Crabb2020-09-071-28/+21
| | | | | | | | | | | | | | | | | | | | | | Changed name of element to "collection" and initial visibility attribute to "visible", and added them to documentation. Also added them to complay.py. Fixed issue with collection inside group, and improved initial view selection behaviour. Updated some internal layouts to demonstrate new features, including et3400, irrmaze, ltcasino, mekd3/mekd4, seawolf and vgmplay. Removed all uses of cpanel, marquee and overlay from internal layouts and removed them from complay.py to actively discourage use. Also cleaned up view names in layouts that were using them in place of spaces, and removed some superfluous name attributes on elements that won't do anything useful with an output value anyway. Made vgmplay cycle visualiser modes when visualiser screen is clicked. Fixed a copy/paste error in bus/rs232/hlemouse.cpp while I'm at it.
* render.cpp: May need to recompute selected view when loading visibility ↵ Vas Crabb2020-09-061-0/+3
| | | | toggle configuration.
* -util/xmlfile: Escape attribute and element content. Vas Crabb2020-09-061-120/+196
| | | | | | | | | | | | | | | | | | | | The previous behaviour was unintuitive - parsing an XML file and writing it out immediately would produce invalid XML if the file contained any characters that needed escaping. It makes far more sense to escape on writing rather than expecting the user to escape input. -Add preliminary support for visibility toggles to artwork system. This allows the user to show/hide related elements in a view, with nesting. The view can specify whether elements are shown or hidden by default. Settings are saved per host window/screen per view. There is no way to set the initial visibility state on the command line. Legacy "Space Invaders cabinet model" layers are mapped onto visibility toggles. This is not stable yet. In particular, the XML element/attribute names have not been finalised. The new features have not been added to complay.py to prevent them from being used before they're finalised.
* render: don't add parent set external artwork if artwork found hap2020-07-251-4/+7
|
* various devices and drivers: removed superfluous semicolons (nw) Ivan Vangelista2020-06-291-1/+1
|
* emu: correct some file headers (nw) hap2020-06-191-1/+1
|
* ui: only warn about external artwork when it wasn't loaded (nw) hap2020-06-131-12/+14
|
* ROM loading cleanup: Vas Crabb2020-04-151-22/+18
| | | | | | | | | | | | | | * More flexible constructors for path_iterator and emu_file * More straightforward system/device ROM loading and software loading when using ROM loader * Proper parent walk when searching for identical CHDs with different names from software list * Fixed hangs if software item parents form a loop * Fixed layouts being loaded from bogus empty paths Note that there are changes in behaviour: * For software list ROMs/disks, MAME will now search the software path before searching the machine path * The search path for the owner of the software list device is used, which may not be the driver itself * MAME will no longer load loose CHDs from the media path - it's just too unwieldy with the number of supported systems * MAME will no longer search archives above the top level of the media path
* render: initialization outer box darkened/less distracting (nw) hap2020-04-041-1/+1
|
* (nw) Cleanup on the way: Vas Crabb2020-03-101-6/+6
| | | | | | | | | | * Add doxygen comments for bit manipulation functions * Add an overload of BIT that works like the AArch64 UBFX instruction * Kill off some of the silly concatenating overloads for emu_file::open * Make searchpath acually useful for devices This is a checkpoint - I'm planning to improve ROM loading behaviour at least a little.
* fixed some clang-tidy warnings (nw) (#6197) Oliver Stöneberg2020-01-221-1/+1
| | | | | | | | | | | | | | * fixed some bugprone-throw-keyword-missing clang-tidy warnings (nw) * fixed some modernize-use-nullptr clang-tidy warnings (nw) * fixed some readability-delete-null-pointer clang-tidy warnings (nw) * fixed some performance-faster-string-find clang-tidy warnings (nw) * fixed some performance-for-range-copy clang-tidy warnings (nw) * fixed some readability-redundant-string-cstr clang-tidy warnings (nw)
* Clean up render_screen_list code, replacing simple_list with std::list (nw) AJR2019-11-241-25/+17
|
* -bgfx: Fixed Github issues #5830 and #5956. [Ryan Holtz] MooglyGuy2019-11-241-1/+1
|