summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cheat.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename *.c -> *.cpp in our source (nw) Miodrag Milanovic2015-11-081-1447/+0
|
* Relaxed emu.h a bit, should make compile a bit faster (nw) Miodrag Milanovic2015-11-051-0/+1
|
* making logerror part of machine and device classes [Miodrag Milanovic] Miodrag Milanovic2015-11-011-4/+4
| | | | display tag of device that logged message
* Cleanups and version bumpmame0163 Miodrag Milanovic2015-06-241-2/+2
|
* cheat: improved cheat support for games in softlist. XML cheats etabeta782015-06-021-5/+10
| | | | | | | | | | | | for home systems should now be stored in a subfolder (or a compressed archive), named after the software list, inside the cheatpath. this allows for loading cheats for consoles / home computers without interfering with arcade cheats when games have identical shortnames. For instance, loading Galaga in NES allows now to use its specific cheats even if a galaga.xml is available in the arcade cheat.7z (previously you'd get an error due to the arcade cheat referring to a cpu not present in the NES). [Pugsy, Fabio Priuli]
* moved all to std::string (nw) Miodrag Milanovic2015-04-221-52/+54
|
* removed bool conversion and implicit empty check (nw) Miodrag Milanovic2015-04-191-7/+7
|
* string -> str rename due to future conflicts (nw) Miodrag Milanovic2015-04-121-40/+40
|
* There is no implicit conversion to char* in std::string (nw) Miodrag Milanovic2015-04-121-8/+8
|
* cstr() - > c_str() as preparation for move to std::string (nw) Miodrag Milanovic2015-04-111-8/+8
|
* Moved eminline and related files into /src/osd since it's system related (nw) Miodrag Milanovic2014-04-161-11/+11
| | | | | | | | Moved delegates into /src/lib/util to enable usage of delegates in other project parts Moved mame_printf_* calls into /src/osd/osdcore.c and renamed them to osd_printf_* Changed mess.mak to display compilation of ymmu100.ppm nicely
* Moved core template container classes up from emutempl.h to coretmpl.h: Aaron Giles2014-03-111-24/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Aaron Giles] * these classes now no longer take a resource_pool; everything is managed globally -- this means that objects added to lists must be allocated with global_alloc * added new auto_pointer<> template which wraps a pointer and auto-frees it upon destruction; it also defaults to NULL so it doesn't need to be explicitly initialized * moved tagged_list template to tagmap.h Redo of the low-level memory tracking system: [Aaron Giles] * moved low-level tracking out of emu\emualloc into lib\util\corealloc so it can be shared among all components and used by core libraries * global_alloc and friends no longer use a resource pool to track allocations; turns out this was a wholly redundant system that wasted a lot of memory * removed global_resource_pool entirely * added global_free_array to delete arrays allocated with global_alloc_array * added tracking of object versus array allocation; we will now error if you use global_free on an array, or global_free_array on an object Added new utility helper const_string_pool which can be used to efficiently accumulate strings that are not intended to be modified. Used by updated makelist and software list code. [Aaron Giles] Updated png2bdc and makelist tools to not leak memory and use more modern techniques (no more MAX_DRIVERS in makelist, for example). [Aaron Giles] Deprecated auto_strdup and removed all uses by way of caller-managed astrings and the software list rewrite. [Aaron Giles] Rewrote software list management: [Aaron Giles] * removed the notion of a software_list that is separate from a software_list_device; they are one and the same now * moved several functions into device_image_interface since they really didn't belong in the core software list class * lots of simplification as a result of the above changes Additional notes (no whatsnew): Moved definition of FPTR to osdcomm.h. Some changes happened in the OSD code to fix issues, especially regarding freeing arrays. SDL folks may need to fix up some of these. The following devices still are using tokens and should be modernized (I found them because they kept their token as void * and tried to delete it, which you can't): namco_52xx_device (mame/audio/namco52.c) namco_54xx_device (mame/audio/namco54.c) namco_06xx_device (mame/machine/namco06.c) namco_50xx_device (mame/machine/namco50.c) namco_51xx_device (mame/machine/namco51.c) namco_53xx_device (mame/machine/namco53.c) voodoo_device (emu/video/voodoo.c) mos6581_device (emu/sound/mos6581.c) aica_device (emu/sound/aica.c) scsp_device (emu/sound/scsp.c) dmadac_sound_device (emu/sound/dmadac.c) s3c2440_device (emu/machine/s3c2440.c) wd1770_device (emu/machine/wd17xx.c) latch8_device (emu/machine/latch8.c) duart68681_device (emu/machine/68681.c) s3c2400_device (emu/machine/s3c2400.c) s3c2410_device (emu/machine/s3c2410.c) strataflash_device (mess/machine/strata.c) hd63450_device (mess/machine/hd63450.c) tap_990_device (mess/machine/ti99/990_tap.c) omti8621_device (mess/machine/omti8621.c) vdt911_device (mess/video/911_vdt.c) apollo_graphics_15i (mess/video/apollo.c) asr733_device (mess/video/733_asr.c)
* Moved src/emu/ui.? ==> src/emu/ui/ui.?, changed to follow MAME OOP ↵ Nathan Woods2014-01-291-4/+4
| | | | conventions; we now have a ui_manager class
* Bulk convert files that already had standard BSD license in my name Aaron Giles2013-10-161-31/+2
| | | | to new license tagged form.
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-32/+32
|
* Some cleanup of some observed #include redundancy from source files which ↵ Scott Stone2012-02-061-1/+0
| | | | use emu.h (nw)
* Move devices into a proper hierarchy and handle naming Aaron Giles2012-01-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and paths consistently for devices, I/O ports, memory regions, memory banks, and memory shares. [Aaron Giles] NOTE: there are likely regressions lurking here, mostly due to devices not being properly found. I have temporarily added more logging to -verbose to help understand what's going on. Please let me know ASAP if anything that is being actively worked on got broken. As before, the driver device is the root device and all other devices are owned by it. Previously all devices were kept in a single master list, and the hierarchy was purely logical. With this change, each device owns its own list of subdevices, and the hierarchy is explicitly manifest. This means when a device is removed, all of its subdevices are automatically removed as well. A side effect of this is that walking the device list is no longer simple. To address this, a new set of iterator classes is provided, which walks the device tree in a depth first manner. There is a general device_iterator class for walking all devices, plus templates for a device_type_iterator and a device_interface_iterator which are used to build iterators for identifying only devices of a given type or with a given interface. Typedefs for commonly-used cases (e.g., screen_device_iterator, memory_interface_iterator) are provided. Iterators can also provide counts, and can perform indexed lookups. All device name lookups are now done relative to another device. The maching_config and running_machine classes now have a root_device() method to get the root of the hierarchy. The existing machine->device("name") is now equivalent to machine->root_device().subdevice("name"). A proper and normalized device path structure is now supported. Device names that start with a colon are treated as absolute paths from the root device. Device names can also use a caret (^) to refer to the owning device. Querying the device's tag() returns the device's full path from the root. A new method basetag() returns just the final tag. The new pathing system is built on top of the device_t::subtag() method, so anyone using that will automatically support the new pathing rules. Each device has its own internal map to cache successful lookups so that subsequent lookups should be very fast. Updated every place I could find that referenced devices, memory regions, I/O ports, memory banks and memory shares to leverage subtag/subdevice (or siblingtag/siblingdevice which are built on top). Removed the device_list class, as it doesn't apply any more. Moved some of its methods into running_machine instead. Simplified the device callback system since the new pathing can describe all of the special-case devices that were previously handled manually. Changed the core output function callbacks to be delegates. Completely rewrote the validity checking mechanism. The validity checker is now a proper C++ class, and temporarily takes over the error and warning outputs. All errors and warnings are collected during a session, and then output in a consistent manner, with an explicit driver and source file listed for each one, as well as additional device and/or I/O port contexts where appropriate. Validity checkers should no longer explicitly output this information, just the error, assuming that the context is provided. Rewrote the software_list_device as a modern device, getting rid of the software_list_config abstraction and simplifying things. Changed the way FLAC compiles so that it works like other external libraries, and also compiles successfully for MSVC builds.
* Switch to using delegates for some callbacks: Aaron Giles2011-04-271-6/+1
| | | | | | | | | | | | - non-device timer callbacks - machine state changing callbacks - configuration callbacks - per-screen VBLANK callbacks - DRC backend callbacks For the timer case only, I added wrappers for the old-style functions. Over time, drivers should switch to device timers instead, reducing the number of timers that are directly allocated through the scheduler.
* Collapsed device_config and device_t into one class. Updated all Aaron Giles2011-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | existing modern devices and the legacy wrappers to work in this environment. This in general greatly simplifies writing a modern device. [Aaron Giles] General notes: * some more cleanup probably needs to happen behind this change, but I needed to get it in before the next device modernization or import from MESS :) * new template function device_creator which automatically defines the static function that creates the device; use this instead of creating a static_alloc_device_config function * added device_stop() method which is called at around the time the previous device_t's destructor was called; if you auto_free anything, do it here because the machine is gone when the destructor is called * changed the static_set_* calls to pass a device_t & instead of a device_config * * for many devices, the static config structure member names over- lapped the device's names for devcb_* functions; in these cases the members in the interface were renamed to have a _cb suffix * changed the driver_enumerator to only cache 100 machine_configs because caching them all took a ton of memory; fortunately this implementation detail is completely hidden behind the driver_enumerator interface * got rid of the macros for creating derived classes; doing it manually is now clean enough that it isn't worth hiding the details in a macro
* Switch from m_machine to machine() everywhere. In some cases this Aaron Giles2011-04-181-10/+10
| | | | | | | | | | | meant adding a machine() accessor but it's worth it for consistency. This will allow future changes from reference to pointer to happen transparently for devices. [Aaron Giles] Simple S&R: m_machine( *[^ (!=;]) machine()\1
* BIG update. Aaron Giles2011-03-291-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove redundant machine items from address_space and device_t. Neither machine nor m_machine are directly accessible anymore. Instead a new getter machine() is available which returns a machine reference. So: space->machine->xxx ==> space->machine().xxx device->machine->yyy ==> device->machine().yyy Globally changed all running_machine pointers to running_machine references. Any function/method that takes a running_machine takes it as a required parameter (1 or 2 exceptions). Being consistent here gets rid of a lot of odd &machine or *machine, but it does mean a very large bulk change across the project. Structs which have a running_machine * now have that variable renamed to m_machine, and now have a shiny new machine() method that works like the space and device methods above. Since most of these are things that should eventually be devices anyway, consider this a step in that direction. 98% of the update was done with regex searches. The changes are architected such that the compiler will catch the remaining errors: // find things that use an embedded machine directly and replace // with a machine() getter call S: ->machine-> R: ->machine\(\)\. // do the same if via a reference S: \.machine-> R: \.machine\(\)\. // convert function parameters to running_machine & S: running_machine \*machine([^;]) R: running_machine \&machine\1 // replace machine-> with machine. S: machine-> R: machine\. // replace &machine() with machine() S: \&([()->a-z0-9_]+machine\(\)) R: \1 // sanity check: look for this used as a cast (running_machine &) // and change to this: *(running_machine *)
* Cleanup of machine.h. Shuffled some fields around, and moved several Aaron Giles2011-03-281-4/+4
| | | | | | | | | | | | | to private member variables with accessors: machine->m_respool ==> machine->respool() machine->config ==> machine->config() machine->gamedrv ==> machine->system() machine->m_regionlist ==> machine->first_region() machine->sample_rate ==> machine->sample_rate() Also converted internal lists to use simple_list.
* Converted core_options to a class. Removed a bunch of marginal Aaron Giles2011-03-031-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functionality in favor of alternate mechanisms. Errors are now reported via an astring rather than via callbacks. Every option must now specify a type (command, integer, float, string, boolean, etc). Command behavior has changed so that only one command is permitted. [Aaron Giles] Changed fileio system to accept just a raw searchpath instead of an options/option name combination. [Aaron Giles] Created emu_options class dervied from core_options which wraps core emulator options. Added mechanisms to cleanly change the system name and add/remove system-specific options, versus the old way using callbacks. Also added read accessors for all the options, to ensure consistency in how parameters are handled. Changed most core systems to access emu_options instead of core_options. Also changed machine->options() to return emu_options. [Aaron Giles] Created cli_options class derived from emu_options which adds the command-line specific options. Updated clifront code to leverage the new class and the new core behaviors. cli_execute() now accepts a cli_options object when called. [Aaron Giles] Updated both SDL and Windows to have their own options classes, derived from cli_options, which add the OSD-specific options on top of everything else. Added accessors for all the options so that queries are strongly typed and simplified. [Aaron Giles] Out of whatsnew: I've surely screwed up some stuff, though I have smoke tested a bunch of things. Let me know if you hit anything odd. Also I know this change will impact the WINUI stuff, please let me know if there are issues. All the functionality necessary should still be present. If it's not obvious, please talk to me before adding stuff to the core_options class.
* mame_file is now emu_file and is a class. It is required Aaron Giles2011-02-121-62/+56
| | | | | | | | | | | | | | | | | | | | | | | | to pass a core_options object to the constructor, along with a search path. This required pushing either a running_machine or a core_options through some code that wasn't previously ready to handle it. emu_files can be reused over multiple open/close sessions, and a lot of core code cleaned up nicely as things were converted to them. Also created a file_enumerator class for iterating over files in a searchpath. This replaces the old mame_openpath functions. Changed machine->options() to return a reference. Removed public nvram_open() and fixed jchan/kaneko16 to stop directly saving NVRAM. Removed most of the mame_options() calls; this will soon go away entirely, so don't add any more. Added core_options to device_validity_check() so they can be used to validate things.
* cheat.c: added support for cheats with software list shortnames [Fabio Priuli] Fabio Priuli2011-01-121-5/+14
|
* Cleanup & version bump.mame0140u1 Aaron Giles2010-11-081-27/+27
|
* Converted the expression engine to C++, did the usual cleanup. Aaron Giles2010-11-011-120/+73
|
* C++-ified the cheat engine. Aaron Giles2010-10-271-1483/+1071
|
* Converted render.c objects into C++ objects. Updated all callers. Aaron Giles2010-10-131-2/+2
|
* Added bool operator to astring, returning true if the string is Aaron Giles2010-08-211-5/+5
| | | | | | not empty. Conveniently, this creates ambiguity if you write astring == NULL. Rooted out remaining cases where we were doing that and fixed them.
* Fix crash when loading cheats, plus a bit of minor cleanup. Aaron Giles2010-08-211-15/+11
|
* Cleanups and version bump.mame0138u3 Aaron Giles2010-07-061-2/+2
|
* Update cheat loading to support image devices (moved implementation from ↵ Miodrag Milanovic2010-07-021-11/+16
| | | | MESS), use only CRC of first found image. [Miodrag Milanovic]
* Split mame.c into mame.c and machine.c, the latter containing the Aaron Giles2010-06-301-11/+11
| | | | | | | | | | | | | | | | | | | running_machine definition and implementation. Moved global machine-level operations and accessors into methods on the running_machine class. For the most part, this doesn't affect drivers except for a few occasional bits: mame_get_phase() == machine->phase() add_reset_callback() == machine->add_notifier(MACHINE_NOTIFY_RESET, ...) add_exit_callback() == machine->add_notifier(MACHINE_NOTIFY_EXIT, ...) mame_get_base_datetime() == machine->base_datetime() mame_get_current_datetime() == machine->current_datetime() Cleaned up the region_info class, removing most global region accessors except for memory_region() and memory_region_length(). Again, this doesn't generally affect drivers.
* Disable many unused variables as identifed by cppcheck. [Oliver Stöneberg] Scott Stone2010-04-231-2/+2
|
* UI menu interface changes Couriersud2010-01-271-2/+2
| | | | | | - all ui functions now expect a render_container - removed all macros referencing render_container_get_ui - ui_menu_alloc now is passed a container to which to render the menu. This is a first round of changes to allow using ui_* functions in a more generic way.
* Fix cheat crash and comment display. Aaron Giles2010-01-111-2/+4
|
* First round of an attempted cleanup of header files in the system. Aaron Giles2010-01-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Created new central header "emu.h"; this should be included by pretty much any driver or device as the first include. This file in turn includes pretty much everything a driver or device will need, minus any other devices it references. Note that emu.h should *never* be included by another header file. - Updated all files in the core (src/emu) to use emu.h. - Removed a ton of redundant and poorly-tracked header includes from within other header files. - Temporarily changed driver.h to map to emu.h until we update files outside of the core. Added class wrapper around tagmap so it can be directly included and accessed within objects that need it. Updated all users to embed tagmap objects and changed them to call through the class. Added nicer functions for finding devices, ports, and regions in a machine: machine->device("tag") -- return the named device, or NULL machine->port("tag") -- return the named port, or NULL machine->region("tag"[, &length[, &flags]]) -- return the named region and optionally its length and flags Made the device tag an astring. This required touching a lot of code that printed the device to explicitly fetch the C-string from it. (Thank you gcc for flagging that issue!)
* Oops, forgot this. Aaron Giles2010-01-081-1/+1
|
* Extended the astring class wrapper into something useful, and Aaron Giles2010-01-081-115/+84
| | | | | | | | | | | | | | | | | | useable as a stack object. Also designed the interfaces to allow for chaining operations. And added a casting operator to const char * for seamless use in most functions that take plain old C strings. Changed all uses of astring to use the object directly on the stack or embedded in objects instead of explicitly allocating and deallocating it. Removed a lot of annoying memory management code as a result. Changed interfaces that accepted/returned an astring * to use an astring & instead. Removed auto_alloc_astring(machine). Use auto_alloc(machine, astring) instead.
* NOTE: This change requires two new osd functions: osd_malloc() and Aaron Giles2010-01-081-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | osd_free(). They take the same parameters as malloc() and free(). Renamed mamecore.h -> emucore.h. New C++-aware memory manager, implemented in emualloc.*. This is a simple manager that allows you to add any type of object to a resource pool. Most commonly, allocated objects are added, and so a set of allocation macros is provided to allow you to manage objects in a particular pool: pool_alloc(p, t) = allocate object of type 't' and add to pool 'p' pool_alloc_clear(p, t) = same as above, but clear the memory first pool_alloc_array(p, t, c) = allocate an array of 'c' objects of type 't' and add to pool 'p' pool_alloc_array_clear(p, t, c) = same, but with clearing pool_free(p, v) = free object 'v' and remove it from the pool Note that pool_alloc[_clear] is roughly equivalent to "new t" and pool_alloc_array[_clear] is roughly equivalent to "new t[c]". Also note that pool_free works for single objects and arrays. There is a single global_resource_pool defined which should be used for any global allocations. It has equivalent macros to the pool_* macros above that automatically target the global pool. In addition, the memory module defines global new/delete overrides that access file and line number parameters so that allocations can be tracked. Currently this tracking is only done if MAME_DEBUG is enabled. In debug builds, any unfreed memory will be printed at the end of the session. emualloc.h also has #defines to disable malloc/free/realloc/calloc. Since emualloc.h is included by emucore.h, this means pretty much all code within the emulator is forced to use the new allocators. Although straight new/delete do work, their use is discouraged, as any allocations made with them will not be tracked. Changed the familar auto_alloc_* macros to map to the resource pool model described above. The running_machine is now a class and contains a resource pool which is automatically destructed upon deletion. If you are a driver writer, all your allocations should be done with auto_alloc_*. Changed all drivers and files in the core using malloc/realloc or the old alloc_*_or_die macros to use (preferably) the auto_alloc_* macros instead, or the global_alloc_* macros if necessary. Added simple C++ wrappers for astring and bitmap_t, as these need proper constructors/destructors to be used for auto_alloc_astring and auto_alloc_bitmap. Removed references to the winalloc prefix file. Most of its functionality has moved into the core, save for the guard page allocations, which are now implemented in osd_alloc and osd_free.
* moved the fix for the crash when you toggle cheats inside cheat.c, to avoid ↵ smf-2010-01-061-19/+28
| | | | duplicating the checks and looking up whether cheats are enabled.
* Cleanups and version bump. Aaron Giles2009-09-101-5/+5
|
* Hooked up F6 again as a global cheat enable/disable. [Pugsy] Aaron Giles2009-09-101-3/+54
|
* Cleanups and version bump.mame0133u5 Aaron Giles2009-09-071-6/+6
|
* Added new function mame_fclose_and_open_next() which will close a file Aaron Giles2009-09-031-51/+77
| | | | | | | | | | | and then keep searching the searchpath for the next valid file. Did some internal rearranging in fileio.c to make this work. Changed cheat search so that it loads *all* cheat files in all search paths. Note that it is easy to end up with duplicate entries this way. Some currently disabled code is present which filters out duplicates, but the logic for doing this is quite unclear with the presence of text-only cheats, which is why the code is disabled for now.
* > From: Pugsy [mailto:pugsy@gmx.net] Aaron Giles2009-09-031-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > Sent: Sunday, August 30, 2009 6:00 PM > To: submit@mamedev.org > Cc: upstephh_wip@yahoo.com > Subject: Added display of cheat comments > > Hi > > One more cheat engine related change. This diff was made against u3 > with the last two diffs I sent > already applied. > > This patch reintroduces the display of the individual cheat comments, > in the old cheat engine this > worked by showing SET,ON or OFF in reverse video to show there was a > comment available which could > be displayed by pressing Shift + Enter. I've done things slightly > different though as I've added a > display comment key of SPACE along with a different way of showing that > a comment is available. > > It now works automatically as soon as you move over a cheat with a > comment it uses popmessage to > display the comment. As soon as you move or press any key (other than > space) it nulls the > popmessage, and by pressing space it will redisplay the comment which > is handy if the comment is a > lengthy one. > > To see it in action look at the bottom two cheats in mslug (or any > neogeo game for that matter). > > Martin 'Pugsy' Pugh > > > MAME Cheat File Maintainer http://mamecheat.co.uk > Gamebase64 Team Member http://www.gamebase64.com >
* From: Pugsy [pugsy@gmx.net] Aaron Giles2009-09-031-5/+26
| | | | | | | | | | | | | | | | | | | | Sent: Friday, August 28, 2009 5:20 PM To: submit@mamedev.org Cc: upstephh_wip@yahoo.com Subject: Add 'Reload All' to cheat menus Hi This update I made against u3 with the last diff I sent already applied. What this does is to add a 'Reload All' option to the cheat menus. This allows you to edit/replace the XMLs and see the changes quickly, without this patch you have to exit and restart MAME to see any cheat file changes. Martin 'Pugsy' Pugh MAME Cheat File Maintainer http://mamecheat.co.uk Gamebase64 Team Member http://www.gamebase64.com
* From Pugsy: Aaron Giles2009-08-191-1/+15
| | | | | | | | | | | | | | | | | | | | | | | > > Currently MESS supports single system cheat xmls > > eg ALL cheats for any SNES game must be in snes.xml, this means that > there will be a lot of cheats > that are not applicable to the game being played. > > This change reverts MESS to a close approximation of how it used to > handle cheats. It will get the > crc32 of the image and load only the appropriate cheats to go with that > image/game by loading > crc32.xml (eg. DEADBEEF.xml). > > > These changes are within ifdef MESS structures so should have no > affect on MAME, and my testing has > not encountered any problems. > > Diff File attached
* Added casts to ensure proper values are passed to the ctype.h functions. Aaron Giles2009-06-251-1/+1
| | | | [Juergen Buchmueller]