Commit Graph

82 Commits

Author SHA1 Message Date
Vas Crabb b67b969bf0 -Improved some Lua APIs:
* Moved several machine lifecycle callbacks to the notifier/subscriber
  model.  The old callback registration model is still available for
  them for now, but prints a deprecation warning.
* Added pre-save/post-load notifications.
* Use a single allocated timer rather than one anonymous timer per
  waiter.  Waiters no longer prevent saved states from being loaded.
* Clean up outstanding waiters on stop or state load rather than just
  leaking them.
* Started documenting parts of the emulator interface object that should
  be relatively stable.

-imagedev/avivideo.cpp: Fixed an object leak on unload.  Also changed
 some other media image devices to use smart pointers.
2023-04-07 06:20:40 +10:00
Vas Crabb d4589e0b29 Input refactoring:
osd/modules/input, emu/inpttype.cpp: Made most default joystick
assignments supplied by input modules.  Input modules take available
controls into consideration when generating default assignments.

emu/inpttype.ipp: Added a separate "Back" UI input separate from Cancel.
You may want an easier to hit combination for moving to the previous
menu than for exiting or cancelling input.  They both default to Escape.

emu/inpttype.ipp: Added a UI Help control.  Currently only used by
analog inputs menu

emu/inpttype.h: Moved I/O port field type enum to its own header and
sorted UI controls so they appear in a more logical order.

ui: Don't use UI Select to restore defaults - people should be getting
used to the UI Clear input by now.  UI Select cycles multi-value items
instead.

ui/inputmap.cpp: Don't use immediate cancel to cycle between clearing
and restoring default assignment (use UI Clear instead).

osd: Reduced the number of files needing to include the dreaded emu.h.
Got some implementation out of headers.
2023-02-18 06:18:45 +11:00
npwoods 13910382a5
osd/modules/file: Don't magically substitute environment variables when opening files. (#9859)
* util/options.cpp: Added option types for single and multiple paths.
* util/options.cpp: Substitute environment variables in values from defaults and INI files.
* ui/dirmenu.cpp: Removed hard-coded list of multi-path options.
* plugins: Don't substitute environment variables in path options.
2022-12-17 06:03:59 +11:00
Vas Crabb e6588480c4
Lua engine improvements (#9453)
Made auto-boot script errors and plugin bootstrap errors fatal.

Run auto-boot scripts in a sandbox.  Globals can be accessed, but not
set.  The sandbox is cleared on hard reset, but not on soft reset.

Added (hopefully) useful to string metafunctions to device_t and
address space that show short names and tags.

Fixed issues in plugins that surface when strict type checking is
enabled, as this means numbers and nil are not automatically converted
to strings.  Plugins should be tested with debug builds to check for
this.

Made save item read_block raise an error on invalid arguments rather
than returning an empty string, and made it use luaL_buffer directly
rather than using the helper wrapper.

Changed some more function bindings to use set_function to avoid issues
related to ThePhD/sol2#608, and got rid of some unnecessary lambda
captures.
2022-03-23 20:27:30 +11:00
cracyc ea0cdde148 plugins/cheatfind: don't try to call a handler for the previous menu option 2022-03-05 09:35:54 -06:00
Vas Crabb de9ed12186 plugins: Reduced amnesia for autofire and inputmacro plugins.
Made autofire and inputmacro plugins capable of remembering settings if
the host input device for the binding is missing or if an input for a
slot device that isn't present is referenced.
2021-11-05 02:46:04 +11:00
cracyc fe0fbb87c2 plugins: fix cheatfind menu flags and write xml cheat text to ui container so it's not sideways on rotated screens 2021-11-03 20:01:07 -05:00
Vas Crabb 4601e60391 plugins: Use SPDX short identifiers for licenses in exports (more precise and easier to localise), use CC0 for hiscore plugin rather than CC0. 2021-10-25 01:57:07 +11:00
Vas Crabb 22bc3486c3 More user experience improvements:
frontend: Made it possible to cancel a media audit while it's in
progress.  Also made the media audit multi-threaded so it's faster.

frontend: Made the DIP switches in the DIP switch preview clickable.

frontend: Made the system and software selection menus leave focus on
the same system when clearing the search rather than jumping to the
first item.  Also fixed a couple of bugs in the logic for keeping the
selected item visible.

frontend: Fixed a few places that weren't showing localised system
names.

frontend: Made UI Cancel clear a search in the file manager the same way
it does on the system and sofware selection menus.

frontend: Made it possible for plugin menus to handle UI Cancel more
naturally, backing up to the previous plugin menu rather than dropping
straight back to the list of plugins.  Updated the autofire, cheat and
cheatfind plugins, and fixed a few other issues in the cheatfind plugin.

debugger: Made the mount and unmount commands accept instance names as
well as brief instance names.  Also updated another page of debugger
documentation.
2021-10-15 10:12:56 +11:00
cracyc 6bf76d0453 plugins/cheatfind: fix watch and write 2021-02-19 12:32:25 -06:00
Vas Crabb 9e36b6a6d9 More Lua interface cleanup - it's simpler with cleaner underlyng APIs.
Made the sound manager mute controls readable, and got rid of system
enable since it just controls system mute anyway.  This was causing
confusion: phantom2 was trying to use both independentlyt casuing the
mute bit to be ignored.

THe Lua interface changes are mostly changing methods to properties,
some renames to make things clearer, and some additional properties for
better control over snapshots.
2020-12-27 01:32:37 +11:00
Vas Crabb 503332a986 -Lua cleanup and documentation migration checkpoint.
* Cleaned up some more of the Lua inteface.  Mostly replacing methods
  with properties, some consistency fixes, a few renames, some more
  exposed functionality, and a couple of properties that have no
  business being set from scripts made read-only.
* Moved a lot more Lua documentation out of source comments into the
  documentation, and expanded on it in the process.
* Got more UI code out of the input manager.
* Changed input sequence poller to a polymorphic class where you
  specify your intention upfront.
* Changed the cheat plugin to use UI Clear to clear hotkey assignments
  and leave them unchanged if the user starts assignment but doesn't
  press any switches.
* Ported AJR's fix for over-eager double-click recognition from SDL to
  Windows OSD.

-goldnpkr.cpp: Cleaned up inputs, using standard keyout and payout types
 and key assignments.
2020-12-16 02:18:52 +11:00
AJR e70d4ebb34 plugins: Replace environment variable substitution function with core version 2020-12-08 09:44:32 -05:00
Vas Crabb e008c7b1b1 -Lua engine cleanup, input edition:
* Modernised and cleaned up Lua bindings for input classes.
* Exposed the input_sequence_poller class to Lua and updated the
  autofire and cheat plugins to use it, rather than continuing to
  pretend it's part of the input manager.
* Exposed more of the natural keyboard manager, including the ability
  to enable/disable individual keyboard and keypad devices like you
  can from the keyboard mode menu.
* Exposed a few more things on ioport_port and input_device.

-plugins/cheat: Fixed menu item not updating visually when disabling a
 cheat with UI Left.

-plugins/cheatfind: Fixed not finding the first screen after screen
 enumerator was exposed as an object rather than using a table.

-bwidow.cpp, pacman.cpp: Minor cleanup to recent changes.
2020-12-09 01:10:26 +11:00
Vas Crabb 1bdf8d272a frontend: Lua engine improvements.
Added methods for enabling and disabling breakpoints and watchpoints,
and made debugger views update when breakpoints/watchpoints are
manipulated from Lua.  Made breakpoints and watchpoints objects rather
than tables.  (It’s not possible to enable/disable a breakpoint or
watchpoint from the object itself, you have to go through its owners'
debug interface.)

Exposed more device_t members for dealing with child/sibling tags and
devices.  Also provided a way to get regions/shares/banks from a device
using relative tags rather than going through the memory manager with
absolute tags.
2020-11-30 12:01:14 +11:00
cracyc 9c4d1457da plugins: add emu.plugin table to contain plugin exported interfaces 2020-09-13 10:00:54 -05:00
cracyc 5528afb489 plugins/cheatfind: permit entry of cheat names 2019-11-27 14:12:02 -06:00
cracyc 99a628eb7c plugins/cheatfind: pull https://github.com/mamedev/mame/pull/4618 with some simplifications and bugfixes (nw) 2019-11-17 21:12:41 -06:00
Vas Crabb 97b6717027 (nw) Clean up the mess on master
This effectively reverts b380514764 and
c24473ddff, restoring the state at
598cd52272.

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.
2019-03-26 11:13:37 +11:00
andreasnaive b380514764 Revert "conflict resolution (nw)"
This reverts commit c24473ddff, reversing
changes made to 009cba4fb8.
2019-03-25 23:13:40 +01:00
Vas Crabb 0ed2d2684e srcclean (nw) 2019-02-24 14:25:42 +11:00
PugsyMAME 87e633e039
Cheat Finder Usability Improvements
1. Changes visual indications to make it nicer & quicker to use.
2. Adds selectable automatic pause capability to the cheat finder menu.
3. Allows the Test/Write poke to be changed
4. Adds another cheat format capability for cheat.simple (write support only)
2019-02-04 21:59:31 +00:00
cracyc 74ff29e228 plugins/cheatfind: fix address step when shift is negative (nw) 2019-01-26 22:18:14 -06:00
cracyc 48f61988db plugins/cheatfind: fix typo (nw) 2018-12-22 18:11:13 -06:00
cracyc 31850556b4 plugins/cheatfind: oops (nw) 2018-11-21 12:50:58 -06:00
cracyc 7301399d2e plugins/cheatfind: fix xml writer (nw) 2018-11-08 08:19:27 -06:00
Vas Crabb 250c06a4d7 srcclean (nw) 2018-09-23 12:22:35 +10:00
cracyc 26e398ac87 plugins/cheatfind: aligned search option (nw) 2018-08-29 20:57:27 -05:00
cracyc 9f12058484 plugins/cheat[find]: fix memshares (nw) 2018-08-27 20:43:33 -05:00
cracyc d5b9f521af plugins/cheatfind: use explicit integer sizes rather than "native" types (nw) 2018-06-08 20:29:58 -05:00
cracyc fec83c922b plugins: handle the case where the ui prepends the list name to the list entry name (nw) 2018-05-02 09:37:34 -05:00
Vas Crabb 08dde5eb0a srcclean and regenerate localisations (nw) 2018-03-25 02:03:24 +11:00
cracyc c8f58a92e6 plugins/cheatfind: fix string formatting (nw) 2018-03-23 21:22:29 -05:00
cracyc a8633e35a4 plugins/cheatfind: search any address space (nw) 2018-03-23 09:09:29 -05:00
cracyc e491b70f03 plugins/cheatfind: read whole block (nw) 2018-01-29 14:14:39 -06:00
cracyc 2e3efc5eff plugins/cheatfind: fix (nw) 2018-01-28 16:46:41 -06:00
Firehawke 9ece34eb21 Revert "Revert "Merge branch 'master' of https://github.com/mamedev/mame""
This reverts commit 54155441e9.
2017-12-13 21:31:27 -07:00
Firehawke 54155441e9 Revert "Merge branch 'master' of https://github.com/mamedev/mame"
This reverts commit f537428e5a, reversing
changes made to 0d70d79810.
2017-12-13 21:01:10 -07:00
Vas Crabb 4995201684 fix sentence building by concatenation, and at the same time collapse two translatable strings to one (nw) 2017-12-02 19:09:25 +11:00
cracyc 56ea65ede2 plugins/cheatfind: oops (nw) 2017-10-15 18:58:43 -05:00
Vas Crabb 2851d7d6cd (nw) Improve localisation:
* Change makefile rules to treat mame.pot as a target so rules can depend on it
* Put mame.pot inside the build directory so it will get cleaned
* Couldn't get xgettext to scrape lua and C++ in the same command and still remove stale strings
* Use larger strings and format specifiers to fix some localisation issues
  - Issue with "None" lacking context in Russian and Turkish translations
  - Issue with "Not implemented" changing depending on the noun in Serbian
  - Issues with lua plugins not allowing for languages with different grammar/punctuation

Strings that need to be translated after this change - most of these are existing text that's been made into larger chunks or reworded slightly:

"Mechanical Machine\tYes\n"

"Mechanical Machine\tNo\n"

"Requires Artwork\tYes\n"

"Requires Artwork\tNo\n"

"Requires Clickable Artwork\tYes\n"

"Requires Clickable Artwork\tNo\n"

"Support Cocktail\tYes\n"

"Support Cocktail\tNo\n"

"Driver is BIOS\tYes\n"

"Driver is BIOS\tNo\n"

"Support Save\tYes\n"

"Support Save\tNo\n"

"Screen Orientation\tVertical\n"

"Screen Orientation\tHorizontal\n"

"Requires CHD\tYes\n"

"Requires CHD\tNo\n"

"ROM Audit Result\tOK\n"

"ROM Audit Result\tBAD\n"

"Samples Audit Result\tNone Needed\n"

"Samples Audit Result\tOK\n"

"Samples Audit Result\tBAD\n"

"ROM Audit Disabled\t\n"
"Samples Audit Disabled\t\n"

"Activated: %s = %s"

"Activated: %s"

"Enabled: %s"

"Disabled: %s"

"%s added"

"Default name is %s"

"Cheat written to %s and added to cheat.simple"

"Unable to write file\n"
"Ensure that cheatpath folder exists"
2017-10-03 10:49:30 +11:00
cracyc cf4c08014b plugins: gettextify localizable strings (nw) 2017-09-03 22:04:33 -05:00
cracyc 2afb506b56 plugins/cheatfind: be more careful with unpack (nw) 2017-06-11 17:20:55 -05:00
Vas Crabb 7238415d1f srcclean (nw) 2016-11-27 09:56:49 +11:00
cracyc bfc49b0974 luaengine: bugfixes (nw) 2016-11-02 12:16:10 -05:00
Vas Crabb f5356a62de srcclean on lua plugins, too 2016-08-30 15:53:27 +10:00
cracyc 2af957118a plugins/cheatfind: don't create 100 copies of a large function when we only need one (nw)
---
The stub keeps the current match in scope so it can be passed on if necessary
2016-07-19 19:53:05 -05:00
cracyc 8d9fb8e4a9 plugins/cheatfind: name cheats (nw) 2016-07-19 19:13:09 -05:00
cracyc fa6bd37265 plugins/cheatfind: add operand size to simple cheat and write cheats from cheatfind into simple file (nw) 2016-07-14 14:57:47 -05:00
cracyc 1a54c90838 plugins/cheatfind: don't show arrow when one option (nw) 2016-07-08 18:52:57 -05:00