summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/save.h
Commit message (Collapse)AuthorAgeFilesLines
* Enable flexible structure saving. Aaron Giles2021-09-151-31/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces the ability to save arbitrary structures. To make a structure eligible for saving, it must implement a new method register_save(save_registrar &). Structs can then save their members directly via the provided save_registrar. Nested structs and arrays of structs are supported in this manner. Note that state registration is not done via a virtual method or mix-in interface because doing so would convert lightweight structures away from being POD, and lightweight structures are one of the most common situations where this system can be leveraged in MAME. As a first example, the attotime struct has been changed to support this mechanism for saving, allowing us to remove the special cases for attotimes currently in save_manager. (It would be tempting to do the same for bitmap_t, but bitmaps are defined in lib/util and can't take a dependency on save.h so those special cases will remain.) This is a prologue to full hierarchical save state support, which I am working on in another branch. The save_registrar class name and reg() signatures match current work on that branch, so any changes made to existing code to leverage struct saving in this way will port over cleanly.
* formats, osd, util: Started refactoring file I/O stuff. (#8456) Vas Crabb2021-08-221-4/+4
| | | | | | | | | 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.
* video/avgdvg.cpp: Modernised code somewhat. Vas Crabb2020-11-071-1/+1
| | | | bwidow is still broken, all other games seem to work.
* Fix a Olivier Galibert2020-11-031-1/+1
|
* emu/save.cpp: Fix bad SFINAE trick breaking segapcm.cpp, fix saving attotime ↵ Vas Crabb2020-09-141-9/+5
| | | | array on 32-bit Linux targets that align u64 on 32-bit boundaries
* emu/save.h: Added support for saving arrays of attotimes and renamed macros ↵ Vas Crabb2020-09-141-84/+93
| | | | to make purpose more obvious.
* template save/load code - the copy-pasta had become a liability (nw) Vas Crabb2020-04-081-7/+14
|
* srcclean (nw) Vas Crabb2020-03-221-1/+1
|
* luaengine: save state to/from binary string buffer (#6354) feos2020-02-241-0/+3
| | | | | | | | * luaengine: save state to/from binary string buffer * account for error * luaL_error makes it exit immediately, but explicit return is required by compiler. actual return is nil if it fails.
* save/restore otuput values in save states Vas Crabb2019-12-131-2/+10
|
* Work around MSVC overload resolution issue in save_item/save_pointer (nw) Vas Crabb2019-12-131-29/+32
|
* Added wrapper for using STRUCT_MEMBER with an indeterminate length array Vas Crabb2019-12-091-3/+12
| | | | | * Examples in YM2612 family and MultiPCM * Also used STRUCT_MEMBER to reduce clutter in diexec save state registration
* Allow saving members of structures in n-dimensional arrays, even if the ↵ Vas Crabb2019-12-091-53/+83
| | | | members themselves are n-dimensional arrays - see qsoundhle.cpp for an example of loops disappearing. This can greatly reduce the number of save state registrations in some cases. Obviously I want to know if save states are broken in something by this.
* -save: Print the name of non-fundamental save_items when fatalerroring, for ↵ MooglyGuy2019-11-181-3/+3
| | | | easier debugging. nw
* save.h: change workaround (nw) hap2019-08-211-12/+8
|
* Fix Solaris 2.11 (non-Oracle) Rick V2019-08-191-0/+4
|
* Fix compile error on Linux with NO_USE_XINPUT=0 Kiall Mac Innes2018-10-111-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | In file included from /usr/include/X11/extensions/XInput.h:53:0, from ../../../../../src/osd/modules/input/input_x11.cpp:18: ../../../../../src/emu/save.h:95:32: error: expected unqualified-id before numeric constant static constexpr std::size_t COUNT = 1U; ^ ../../../../../src/emu/save.h:102:32: error: expected unqualified-id before numeric constant static constexpr std::size_t COUNT = N * array_unwrap<T>::COUNT; ^ ../../../../../src/emu/save.h:109:32: error: expected unqualified-id before numeric constant static constexpr std::size_t COUNT = N * array_unwrap<T>::COUNT; ^ ../../../../../src/emu/save.h: In member function ‘void save_manager::save_item(device_t*, const char*, const char*, int, ItemType&, const char*)’: ../../../../../src/emu/save.h:154:142: error: expected unqualified-id before numeric constant save_memory(device, module, tag, index, valname, array_unwrap<ItemType>::ptr(value), array_unwrap<ItemType>::SIZE, array_unwrap<ItemType>::COUNT); ^ ../../../../../src/emu/save.h: In member function ‘void save_manager::save_pointer(device_t*, const char*, const char*, int, ItemType*, const char*, u32)’: ../../../../../src/emu/save.h:163:145: error: expected unqualified-id before numeric constant save_memory(device, module, tag, index, valname, array_unwrap<ItemType>::ptr(value[0]), array_unwrap<ItemType>::SIZE, array_unwrap<ItemType>::COUNT * count); ^ ../../../../../src/emu/save.h: In member function ‘void save_manager::save_pointer(device_t*, const char*, const char*, int, std::unique_ptr<_Tp []>&, const char*, u32)’: ../../../../../src/emu/save.h:172:145: error: expected unqualified-id before numeric constant save_memory(device, module, tag, index, valname, array_unwrap<ItemType>::ptr(value[0]), array_unwrap<ItemType>::SIZE, array_unwrap<ItemType>::COUNT * count);
* Better support for screen orientation/geometry: Vas Crabb2018-07-261-24/+37
| | | | | | | | | | | | | | | | | | | | | * 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 passing std::unique_ptr<TYPE> directly to save_pointer and remove ↵ AJR2018-06-241-23/+31
| | | | now-superfluous .get() in many drivers/devices (nw)
* try this for size - emu.h no net change (nw) Vas Crabb2018-05-181-1/+0
|
* WARNING emu.h recompile! Curt Coder2018-05-181-0/+1
| | | | debugger: Show save state items in alphabetical order in the debugger view. [Curt Coder]
* rewind implementation fixes and improvements vadosnaprimer2017-12-221-18/+23
| | | | | | | | | | | | | - reset scheduler savestate to what it was for years before rewind -- changing saved variables should be done after thorough testing. right now, adding some vars breaks some machines, adding other vars breaks others - switch to megabyte-wise capacity -- savestate size greatly differs between machines, relying on state count is unstable - switch to internal indexing -- no longer depends on inaccurate machine time - rewind accelerator key in debugger (Ctrl+F11) - report capacity hit (once), with some useful info - make error reports saner - mention rewind and rewind_capacity in the docs
* Revert "Revert "Merge branch 'master' of https://github.com/mamedev/mame"" Firehawke2017-12-131-5/+63
| | | | This reverts commit 54155441e9ba9941e85d80c4834a66376a11e791.
* Revert "Merge branch 'master' of https://github.com/mamedev/mame" Firehawke2017-12-131-63/+5
| | | | | This reverts commit f537428e5a40ba6dde8ca9bf0fe9ae6b1f189ac4, reversing changes made to 0d70d798107d4e4e8fb9f230410aeb1e888d65c5.
* Rewind feature and RAM savestates. vadosnaprimer2017-12-061-5/+63
| | | | | | | | | | | | | | This starts the work requested in #2398. How RAM states work. Implemented using util::vectorstream. Instead of dumping m_save.m_entry_list to file, it writes them as binary to vectorstream. Compression is not used, as it would slow down the process. The header is written as usual, also in binary. When a state is loaded, the savestate data gets binary-read from vectorstream. How rewind works. Rewind is optional, it can be turned off through MAME GUI while not running. Rewind capacity is available there too. Rewind step hotkey is available from the standard hotkey menu. In the debugger you have the "rewind" command ("rw" shortcut) that works the same as the hotkey. Every time you advance a frame (pause step), rewinder captures a RAM savestate of the frame you were at. It does the same when you do step into/over/out in the debugger. Every time it captures a new state (and when you unpause), it marks as invalid all its states that go after the current machine time, because input might change, so they are not relevant anymore. It keeps their buffers allocated though, for future use. When rewinder runs out of allowed amount of savestates it can have, it invalidates the first state in the list and tosses its unique_ptr to the end of the list, then it uses its buffer to capture a new state. When you hit the rewind step key, or use "rewind" command in the debugger, it loads a state that is immediately before the current machine time. Invalid states between valid ones are not allowed to appear, as that breaks rewinder integrity and causes problems. Rewinder keeps its own set of ram states as a vector of unique_ptr's. All rewinder operations and errors get reported using machine().popmessage().
* A round of spelling/typographical fixes to source comments (nw) Scott Stone2016-11-241-1/+1
|
* Introduce u8/u16/u32/u64/s8/s16/s32/s64 Vas Crabb2016-11-191-27/+27
| | | | | | | | | | | | * New abbreviated types are in osd and util namespaces, and also in global namespace for things that #include "emu.h" * Get rid of import of cstdint types to global namespace (C99 does this anyway) * Remove the cstdint types from everything in emu * Get rid of U64/S64 macros * Fix a bug in dps16 caused by incorrect use of macro * Fix debugcon not checking for "do " prefix case-insensitively * Fix a lot of messed up tabulation * More constexpr * Fix up many __names
* Do not use FUNC in delegate where applicable (nw) Miodrag Milanovic2016-11-061-1/+1
|
* NOTICE (TYPE NAME CONSOLIDATION) Miodrag Milanovic2016-10-221-18/+18
| | | | | Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
* simplified memory management for save states and states (nw) Miodrag Milanovic2016-07-011-13/+4
|
* Various cleanups suggested by static analyzer (nw) Miodrag Milanovic2016-04-241-1/+1
|
* reverting: Miodrag Milanovic2016-01-201-14/+14
| | | | | | | SHA-1: 1f90ceab075c4869298e963bf0a14a0aac2f1caa * tags are now strings (nw) fix start project for custom builds in Visual Studio (nw)
* Revert "rest of device parameters to std::string (nw)" Miodrag Milanovic2016-01-201-16/+16
| | | | This reverts commit caba131d844ade3f2b30d6be24ea6cf46b2949d7.
* rest of device parameters to std::string (nw) Miodrag Milanovic2016-01-161-16/+16
|
* tags are now strings (nw) Miodrag Milanovic2016-01-161-14/+14
| | | | fix start project for custom builds in Visual Studio (nw)
* clang-modernize part 5 Miodrag Milanovic2015-12-041-1/+1
|
* clang-modernize part 1 (nw) Miodrag Milanovic2015-12-031-1/+1
|
* Added seconds() and attoseconds() to attotime and prefixed members with couriersud2015-08-151-2/+2
| | | | | | | m_. Rewrote code accessing members to use seconds() and attoseconds(). The changes were triggered by a test how gcc __int128_t would perform as the internal representation. This test revealed that the current implementation is still faster. (nw)
* some extremely low hanging pedantic fruit Cowering2015-07-081-15/+15
|
* Completed state_save_register_item* removal (nw) Ivan Vangelista2015-04-231-11/+0
|
* moved all to std::string (nw) Miodrag Milanovic2015-04-221-5/+5
|
* removed not used state_save_register_item_* calls (nw) Miodrag Milanovic2015-04-181-7/+0
|
* Replace dynamic_array with std::vector [O. Galibert] Olivier Galibert2015-04-141-3/+3
|
* updated astring constructors to have just one string param, to be more like ↵ Miodrag Milanovic2015-04-131-1/+1
| | | | std::string (nw)
* There is no implicit conversion to char* in std::string (nw) Miodrag Milanovic2015-04-121-2/+2
|
* save: Give the device when available to the state save subsystem [O. Galibert] Olivier Galibert2015-02-141-49/+53
|
* save: factor-out presave/postload dispatchers Luca Bruno2015-01-181-0/+4
| | | | Signed-off-by: Luca Bruno <lucab@debian.org>
* Enable saving dynamic_arrays of all fundamental types. Also fix emupal Aaron Giles2014-03-021-66/+22
| | | | | to save the indirection arrays properly when indirect color count is provided up front.
* Huge update, palette is now device (nw) Miodrag Milanovic2014-02-271-0/+12
| | | note: Aaron please give more descriptive text for release log I have no more strength :)
* Switched rgb_t to a class, replacing macros with methods. Mappings are Aaron Giles2014-02-191-0/+1
| | | | | | | | | | | | | | | | | | | as follows: MAKE_RGB(r,g,b) == rgb_t(r,g,b) MAKE_ARGB(a,r,g,b) == rgb_t(a,r,g,b) RGB_ALPHA(data) == data.a() RGB_RED(data) == data.r() RGB_GREEN(data) == data.g() RGB_BLUE(data) == data.b() RGB_BLACK == rgb_t::black RGB_WHITE == rgb_t::white Implicit conversions to/from UINT32 are built in as well as simple addition, subtraction, and scaling (with clamping). As a result of being a class, some stricter typing was needed in a few places but overall not too much.