summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/rendlay.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Various improvements to image file handling: Vas Crabb2020-10-081-102/+346
| | | | | | | | | | | | | | | | | | | | | | | | 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-172/+302
| | | | -cgang.cpp: Make internal artwork more fun.
* emu/rendlay.cpp: Pre-load image components when changing video options. Vas Crabb2020-10-031-24/+85
|
* emu/render.cpp: Consider that screens can be hidden when choosing a default ↵ Vas Crabb2020-10-031-1/+12
| | | | view.
* Got rid of global_alloc/global_free. Vas Crabb2020-10-031-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | 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-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>.
* rendlay.cpp: Correct output alpha for rect and disk components. Vas Crabb2020-09-201-50/+61
| | | | | | This corrects alpha for cases when both the rect/disk and whatever it's drawing over are translucent, and also optimises for fully opaque and fully transparent pixels.
* -emu/rendlay.cpp: Small optimisation for opaque pixels in image component. Vas Crabb2020-09-191-1/+5
| | | | | | -machine/pc1512kb.cpp: Put \| and #~ on the right keys by default. -docs: Re-organised default keys, added P2-4 defaults, added mahjong panel diagram.
* emu/rendlay.cpp: Added parameter animation and state masks. Vas Crabb2020-09-161-228/+495
| | | | | | | | | | | | | | | | | | | 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-28/+83
| | | | | | | | | 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.
* Remove last remaining uses of <background> elements in layouts, and print ↵ Vas Crabb2020-09-101-5/+15
| | | | warning messages on encountering deprecated elements.
* Updated most of the layouts using <bezel> elements Vas Crabb2020-09-091-4/+15
|
* -emu/rendlay.cpp: Fixed uninitialised variable breaking sdtor. Vas Crabb2020-09-091-9/+29
| | | | | | | | | | Also added some optional verbose logging for debugging group bounds calculation. -Updated another batch of layouts. Some chess layouts have had elements reordered in the XML to maintain stacking order when drawing.
* -Fix layout regressions in spacezap/ebases and ccompan. Vas Crabb2020-09-091-4/+5
| | | | | | -emu/rendlay.cpp: Actually add the group bounds calculation fix. -Update a few more layouts.
* Finished adding new mechanism for allowing parts of views to be hidden. Vas Crabb2020-09-071-9/+10
| | | | | | | | | | | | | | | | | | | | | | 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.
* -util/xmlfile: Escape attribute and element content. Vas Crabb2020-09-061-90/+231
| | | | | | | | | | | | | | | | | | | | 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.
* ssystem3: added the new lcd screen to internal artwork hap2020-07-301-2/+2
|
* emu: correct some file headers (nw) hap2020-06-191-1/+1
|
* fixed some clang-tidy warnings (nw) (#6229) Oliver Stöneberg2020-01-291-3/+3
| | | | | | | | | | | | | | | | * fixed some readability-static-accessed-through-instance clang-tidy warnings (nw) * fixed some readability-redundant-string-cstr clang-tidy warnings (nw) * fixed some readability-redundant-control-flow clang-tidy warnings (nw) * fixed some modernize-use-nullptr 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 performance-unnecessary-value-param clang-tidy warnings (nw)
* Merge pull request #6195 from firewave/includes R. Belmont2020-01-221-1/+1
|\ | | | | use C++ library includes (nw)
| * use C++ library includes (nw) firewave2020-01-221-1/+1
| |
* | 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)
* Save states should not be break when changing output. Also get rid of a few ↵ Vas Crabb2019-12-131-6/+7
| | | | | | dozen output().set_value(...) calls in favour of output finders. (nw) This has the detrimental effect that outputs used in layouts will get the default value from the last element in the last view that uses them _after_ devices are started. If drivers/devices set initial output values on start rather than reset this could cause a problem.
* Clean up render_screen_list code, replacing simple_list with std::list (nw) AJR2019-11-241-11/+14
|
* Make osd_printf_* use util/strformat semantics. Vas Crabb2019-09-261-2/+2
| | | | | | | | | | | | | | | | | (nw) This has been a long time coming but it's here at last. It should be easier now that logerror, popmessage and osd_printf_* behave like string_format and stream_format. Remember the differences from printf: * Any object with a stream out operator works with %s * %d, %i, %o, %x, %X, etc. work out the size by magic * No sign extending promotion to int for short/char * No widening/narrowing conversions for characters/strings * Same rules on all platforms, insulated from C runtime library * No format warnings from compiler * Assert in debug builds if number of arguments doesn't match format (nw) Also removed a pile of redundant c_str and string_format, and some workarounds for not being able to portably format 64-bit integers or long long.
* rendlay.cpp: Remove useless c_str calls (nw) AJR2019-09-061-5/+1
|
* Fix some clang warnings (nw) MoochMcGee2019-08-311-3/+3
|
* MT07379: better automatic group bounds behaviour Vas Crabb2019-08-201-5/+19
|
* Allow per-layer blend modes supplied by driver for screens, as required Vas Crabb2019-07-271-13/+7
| | | | | | | | | for Laserdisc overlays. This is a change in behaviour, and it means that games like Golly! Ghost! will need an explicit blend mode specified in the XML. I'm not entirely happy with the situation, but a better, more general solution than this would require some serious refactoring to MAME's renderer.
* rendlay: render 7seg off-segments and background with alpha, this allows lcd ↵ hap2019-07-261-13/+13
| | | | 7segs (nw)
* (nw) handle layouts that wanted screens to be opaque. if you have a layout ↵ Vas Crabb2019-07-121-9/+20
| | | | with only screens and need to add, mark them explicitly. haven't tracked down the lightgun pointer issue yet.
* don't crash when a layout references a conditional I/O port field (nw) Vas Crabb2019-07-061-9/+19
|
* (nw) forgot to add that group check Vas Crabb2019-07-061-6/+7
|
* Make layout format more flexible: Vas Crabb2019-07-061-114/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * There is no longer a concept of "layers" - there are only screens and elements. * Elements are now instantiated with <element ref="..."> * Screens and elements can have explicit blending mode specified with blend="..." * Default blending mode for screens is "add" and default for other elements is "alpha" * Other supported modes are "none" and "multiply" * This removes the options to enable/disable layers individually - use views instead * Legacy layouts can still be loaded, and support won't be removed for at least a year The current artwork model is over-stretched. It's based on a Space Invaders cabinet model, and isn't applicable to a lot of the systems MAME emulates now. The fact that MAME has to switch to an "alternate" mode to deal with games like Golly! Ghost! without requiring pre-matted bitmaps shows that the Space Invaders model wasn't even adequate for general arcade use. It shows in that for a lot of the systems that heavily depend on artwork, people just seem to randomly choose layers for elements until they get something that works. Also, the fact that MAME will switch to an alternate (Golly! Ghost!) mode depending on the combination of elements is a trap for people learning to make artwork. There are cases that the current approach of implying the blending mode from the layer doesn't work with. Examples include LEDs behind diffusers (requires additive blending for layout elements), and mutliple stacked LCD panels (requires RGB multiplication for screens). For configurability, it's now a lot easier to make multiple views using groups. For example, if you want to make it possible to hide the control panel section of your layout, you can put the control panel elements in a group and create views with and without it. I will gradually migrate the internal artwork to use the new approach. I have an XSLT stylesheet that helps with this, but I'm not comfortable adding it because it isn't a complete solution and it still requires manul steps. I wanted to get the re-worked pointer handling done sooner so I could push them both at the same time, but unfortunately various things have prevented me from progressing as quickly as I wanted to. Sorry guys, that stuff's going to have to wait.
* (nw) Clean up the mess on master Vas Crabb2019-03-261-3/+14
| | | | | | | | | | | | | This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release.
* Revert "conflict resolution (nw)" andreasnaive2019-03-251-14/+3
| | | | | This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing changes made to 009cba4fb8102102168ef32870892438327f3705.
* hh_tms1k: added switches to simon layout, added buttons to zodiac layout, ↵ hap2019-03-231-1/+3
| | | | changed inputs to sliders in alphie (nw)
* layout: added "inputraw" parameter, for use with inputtag and inputmask. It ↵ hap2019-03-231-3/+12
| | | | sets the element state directly to the raw input data & mask. Example uses: 8 way joystick state, multi-bitmask dipswitch state. If you don't want it to respond to layout mouse clicks, add a dummy inputtag rect under it. (nw)
* (nw) apparently msys glibstdc++ doesn't have that std::abs overload... Vas Crabb2018-08-021-6/+7
|
* (nw) Further layout work: Vas Crabb2018-08-021-95/+173
| | | | | | | | * Allow <orientation> and <color> to work on group references * Fix some corner cases where group bounds could be miscalculated * Fix a corner case where MAME could incorrectly refuse to instantiate groups * Add more checks to complay.py * Document more of the layout format
* (nw) more render work: Vas Crabb2018-07-311-35/+45
| | | | | | | | | | | | * Clean up some corner cases in layouts with repeating blocks * Make complay.py validate many more elements and attributes * Make complay.py easier to use for just validating a layout * Remove redundant view from Sega VMU layout * Make buttons visually respond to input in whousetc.lay * Add view with LED displays as well as terminal for aim65_40 and use repeats * Clean up some outdated "game" terminology in clifront.cpp * Initiaise a couple of members in tap/tun network module * Start documenting layout format
* make rectangle work better with constexpr, change many things to use ↵ Vas Crabb2018-07-281-34/+34
| | | | designated getters/setters (nw)
* Better support for screen orientation/geometry: Vas Crabb2018-07-261-44/+12
| | | | | | | | | | | | | | | | | | | | | * Eliminates the need for the horizontal/vertical/LCD/SVG layout files * Screens can now have orientation and physical aspect ratio specified * RASTER/VECTOR defaults to 4:3, LCD/SVG defaults to square pixels at config time * System orientation is applied on top of screen orientation Automatically generated single-screen views and orientation flags in XML output now work correctly for systems with multiple screens in different geometries/orientations, e.g. housemnq, rocnms, stepstag, or netmerc. The "core rotation options" only interact with system orientation. Allowing multi-screen systems to work well with one monitor per emulated screen is a complex topic. System orientation also affects the GFX viewer while screen orientation doesn't. The orientation displayed in the system selection menu is from the system orientation. Let me know if I've broken any systems or use cases. Also, add save state support for std::array/C array nested to any depth.
* allow repeating elements and groups - useful if you need e.g. a lot of ↵ Vas Crabb2018-07-221-25/+58
| | | | numbered labels, but it limits complay.py's ability to check for invalid references as it can't evaluate expressions (nw)
* remember to unwind if environment changes (nw) Vas Crabb2018-07-221-0/+9
|
* rendlay: allow user variables and repetition in layouts, also add a few more ↵ Vas Crabb2018-07-221-346/+909
| | | | predefined variables
* Allow per-device internal layouts and remove some more MCFG_ macros. Vas Crabb2018-07-161-30/+51
| | | | | | | | | | | Input and screen tags are now resolved relative to a layout's owner device. Easy way to demonstrate is with: mame64 intlc440 -tty ie15 Previously you'd only get the IE15 terminal's layout and you'd be unable to use the INTELLEC 4/40 front panel. Now you'll get the choice of layouts from both the system and the terminal device in video options.
* cleanup (nw) Vas Crabb2018-07-121-3/+3
|
* Allow layouts to specify screen tags rather than indices - makes order of ↵ Vas Crabb2018-07-101-1/+4
| | | | instantiation irrelevant in Model 1 etc.
* cleaner handling of layout parsing errors (nw) Vas Crabb2018-03-291-75/+97
|