Commit graph

30 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
5f97af903c
-Lua engine: run everything in coroutines. (#11019)
* This lets you use emu.wait(...) directly without mucking around creating coroutines.
* Allow emu.wait to accept an attotime argument.
* Added a couple more wait helper functions.

-emu/profiler.h: Actually use scope-based profiling helpers.
* This makes the comment at the top of emu/profile.h less dishonest, and makes it easier to write exception-safe code.
* Got rid of some do { ... } while (0) loops that only existed so break could be used like a goto.
2023-03-25 05:53:58 +11:00
Vas Crabb
f2a5f52526 Lua: Be more strict with concurrency and multiple contexts. 2023-03-08 04:09:22 +11:00
Vas Crabb
6dea565343 plugins/console: Fixed tab completion after linenoise update.
* Can now cycle through candidates by repeatedly pushing Tab.
* Also cleaned up Lua thread context object a little, and made it
  possible to pass any Lua object as a status value.
2023-03-08 03:18:21 +11:00
Vas Crabb
8384223ac8 Updated forked linenoise to latest upstream.
This removes the need to force it to build as C++, and adds proper UTF-8
support for Windows.

Since this is a fork of linenoise, there's no hope for getting
lua-linenoise to sync with it upstream.  I made the bare minimum changes
to keep it working, but didn't add bindings for new functionality (e.g.
multi-line editing).
2023-03-07 05:33:37 +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
cracyc
cee44b0414 plugins/console: fix crash 2021-10-30 12:05:58 -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
5fe20586ee srcclean for release 2021-05-23 17:33:52 +10:00
Vas Crabb
fab84e8d2b Mostly revert "Create console history file in homepath (#8026)"
The change to make the console plugin work is preserved.

This reverts commit 25137717c9.
2021-05-07 02:14:05 +10:00
Szunti
25137717c9
Create console history file in homepath (#8026)
* Fix console history path, homepath is a core option

* Create missing directories recursively in lua plugins.

* Add lfs to global environment in a less magical way.

require normally doesn't bind the name globally just returns the
module, mame sets a preloader that does bind lfs globally, but
maybe it's less surprising to do it explicitly
2021-05-03 20:40:10 -04:00
AJR
26defea154 init.lua: Change "historypath" (only supposed to be used for DATs) to "homepath" (where plugin data should reside) 2021-05-02 12:27:54 -04:00
Szunti
b8cb370b74 Save line history for the console and other minor fixes
Changed a loadstring to load, since lua 5.3 loadstring is not
available.
Made sure the linenoise thread returns a string.
After Ctrl+D stop reading lines.
2021-04-25 20:43:10 +02: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
ec80428647 Fairly significant overhaul of Lua engine and some cleanup.
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.
2020-11-25 19:18:26 +11: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
cracyc
836abb0d63 plugins/console: command history (nw) 2019-02-17 09:07:56 -06:00
cracyc
463eddd02b plugins/console: make the console behave like the docs, unlike the official lua console if you are in a block, entering a newline on a blank line gets you out (nw) 2018-02-07 16:32:17 -06:00
cracyc
81079946a4 luaengine: debugger_manager support [Carl] 2017-07-23 20:41:08 -05:00
Vas Crabb
e892661905 srcclean (nw) 2017-05-28 13:40:48 +10:00
cracyc
4ebc18aeec linenoise: replace linenoise-ng with a different port that is simpler and uses a different UTF8 parser [Carl]
plugins/console: better completions [Carl]
2017-05-13 16:57:47 -05:00
Vas Crabb
7238415d1f srcclean (nw) 2016-11-27 09:56:49 +11:00
cracyc
3b512b0fd8 plugins/console: much better completions (nw) 2016-11-07 15:07:52 -06:00
cracyc
65c3796e33 plugins/console: further improve completions by removing break chars from linenoise that hide the full type (nw) 2016-11-06 21:36:26 -06:00
cracyc
cbf588359e plugins/console: (nw) 2016-11-06 13:41:47 -06:00
cracyc
a6aaa59d19 lua-linenoise: add preload (nw) 2016-11-06 13:41:46 -06:00
cracyc
68ff36882c plugins/console: (nw) 2016-11-06 13:41:45 -06:00
cracyc
fad9a96cb0 plugins/console: better completions (nw) 2016-11-06 13:41:45 -06:00
cracyc
2de04414ed plugins/console: add lua console [Carl] 2016-11-06 13:41:43 -06:00