Commit Graph

113 Commits

Author SHA1 Message Date
adelikat b6efbfe54b add hotkey to toggle the last used lua script 2024-03-19 11:10:15 -05:00
James Groom 3fb30a2ca7
Clean up some `AskSaveChanges` implementations 2023-12-22 04:48:49 +00:00
James Groom aaf46cc9a7
Fix `--lua=*.luases` being interpreted as a script (fixes #3814) 2023-10-29 06:38:06 +10:00
Moritz Bender 362269c982
Establish basic style analyzer rules (#3759)
* Fix analyzer nullable error

can't disable them in CA1305 xdd

* .editorconfig -> .globalconfig

* Add basic set of style analyzer rules

* dotnet format output

* Some additional fixes

* Apply manual simplification

* Transform some enum comparisons

* fix typo

* add TODO
2023-08-30 23:08:21 +02:00
Morilli 8e557b0b9d bump AnalysisModeGlobalization to Recommended
fixes CA1304, CA1309, CA1310, CA1311

temporarily silences CA1305

reduce severity of CA2101
2023-08-14 14:18:45 -07:00
James Groom 2150061c91
Update LuaConsole.cs 2023-08-06 03:01:44 +10:00
CasualPokePlayer d3a689c589 Resolve #3650. Also fix a bug which caused overwriting lua scripts with a new lua script to fail (fixes 380e459bec) 2023-05-08 03:01:41 -07:00
YoshiRulz a1fe557d31
Re-enable MA0020 and fix noncompliance 2023-04-16 09:02:40 +10:00
YoshiRulz 380e459bec
Copy from an editable template file when making a new Lua script 2023-03-30 21:43:27 +10:00
YoshiRulz 8b7cba96bb
Use a single-source-of-truth for tools' icons in menus and Tool Box
reverts 733b6c49b
some more `[SpecializedTool]`s have icons now
2023-02-08 07:15:24 +10:00
CasualPokePlayer b3c7f0fa48 IPlatformLuaLibEnv -> ILuaLibraries / Win32LuaLibraries -> LuaLibraries, cleanup usage of it, fix doc error in client.gettool 2022-12-10 21:46:22 -08:00
YoshiRulz 4caa99afe3
Remove Lua in Mono warning as it's no longer relevant
fixes 45fbdb484
2022-12-07 18:46:25 +10:00
kalimag 596e8d9198 Call `onexit` and cleanup when removing lua script 2022-12-07 18:15:31 +10:00
kalimag 50fc7e28da Make "Stop all scripts" behave the same as toggling them off 2022-12-07 18:15:31 +10:00
kalimag 817b258a79 Remove relative path manipulation in `LuaConsole` 2022-12-07 18:15:31 +10:00
kalimag f625771cd0 Don't create FileSystemWatcher for missing directories 2022-12-07 18:15:31 +10:00
kalimag cf2b83b102 Disable lua script if loading fails 2022-12-07 18:15:31 +10:00
kalimag bd53807b0f Store `LuaFile` `FileSystemWatcher` in dictionary
Avoid path string comparisons, `FileSystemWatcher` events may format relative paths differently
2022-12-07 18:15:31 +10:00
kalimag 6aa7c48402 Update Lua registered functions window after restart
Make registered functions window show functions for new LuaImp after core restart/reopening the Lua console
2022-12-07 18:15:31 +10:00
kalimag ee66faba0b Clean up old LuaImp before creating new one
Prevents memory/resource leak

Causes open forms to be closed on core restart
2022-12-07 18:15:31 +10:00
kalimag 3a70fb65f8 Refactor disabling Lua script into separate method 2022-12-07 18:15:31 +10:00
kalimag 7c7ac64ae6 Stop discarding Lua session save directory
Previously any path would into ".\foo.luases" and be saved in exe dir
2022-12-07 18:15:31 +10:00
kalimag 9ee788195a Improve Lua `FileSystemWatcher` thread safety
Make FSW invoke the entire event handler on main thread.

Avoids theoretical race condition and thread safety issues with the linq query.
2022-12-07 18:15:31 +10:00
kalimag 733a8bee88 Dispose FileSystemWatchers in LuaConsole 2022-12-07 18:15:31 +10:00
kalimag 28d6415190 Remove running scripts before loading session
Clean up scripts instead of just clearing script list
2022-12-07 18:15:31 +10:00
kalimag cc10de4033 Refactor removing Lua scripts into separate method 2022-12-07 18:15:31 +10:00
kalimag 564a1e4a67 Remove obsolete `LuaConsole.RunLuaScripts`
Method is mostly a duplicate of `EnableLuaFile`, only called when loading a session or an already loaded script.

In either case it didn't actually start the scripts due to an inverted condition, and would stop running scripts without doing the required cleanup.
2022-12-07 18:15:31 +10:00
kalimag 5d143ca879 Properly start scripts after loading Lua session
Previously, scripts would display as enabled but not actually run until toggled off and on.
2022-12-07 18:15:31 +10:00
kalimag 0effd435f6 Fix issues when opening same Lua script multiple times 2022-12-07 18:15:31 +10:00
kalimag 14e713837b Change remaining `Config.DisableLuaScriptsOnLoad` refs to Settings
Resolve inconsistent use of duplicate property on `Config` and `LuaConsoleSettings`, finishes partial refactoring from 324a50a

This will effectively reset this setting to default in existing configs.
2022-12-07 18:15:31 +10:00
YoshiRulz 84d2866f53
Clean up usage of `LuaFile.Enabled`/`Paused` 2022-12-04 01:43:02 +10:00
CasualPokePlayer f798021bba CloseRom acts like rebooting the core, so make it just reset Lua libs (more properly fixes #3226 without any yield nonsense)
Slight revert of 2efae13af4 (still want to set running scripts as it's used later)
Fix detaching registered functions (old logic was broken, Stop would null out the LuaRef used for creating the new dummy thread for the detached function. best solution i've come up with is to simply pass a callback over for creating the thread, nicely encapsulating that functionality)
Various cleanups, don't need VS complaining about old pattern matching code here anymore...
2022-12-03 04:57:58 -08:00
YoshiRulz 6174398fb4
Also reset padding when removing last Lua script (resolves #1509) 2022-12-03 01:06:06 +10:00
YoshiRulz a9756b60a2
Clear OSD + surfaces when removing a Lua script (resolves #3014)
they were already being cleared when closing the Lua Console
note the "Erase Stale/Stuck Lua Drawing Layers" button does not clear OSD,
leaving that as it is for now
2022-12-03 01:02:26 +10:00
CasualPokePlayer 2efae13af4 prevent some NREs occurring with the new Lua stuff 2022-12-01 14:59:36 -08:00
CasualPokePlayer 45fbdb4844
Move to NLua/KeraLua/Lua5.4 (#3361) 2022-12-01 00:51:02 -08:00
YoshiRulz 84cc71e454
Use `DialogResult.IsOk` extension everywhere and clean up 2022-11-07 06:03:55 +10:00
YoshiRulz 36cb62a792
Create and use `ToolStripDropDownItem.ReplaceDropDownItems` extension 2022-11-07 06:03:55 +10:00
YoshiRulz f1f0f1695c
Encapsulate `OpenFileDialog`/`SaveFileDialog` 2022-11-05 09:10:11 +10:00
YoshiRulz 2db5235319
Cache and reuse `FilesystemFilterSet`s 2022-11-05 09:10:11 +10:00
YoshiRulz c153505b58
Invert some conditionals to reduce nesting 2022-11-05 09:10:10 +10:00
YoshiRulz 7cde8bb466
Add and use 2 extension methods for splitting path into dir+filename 2022-08-17 17:35:07 +10:00
YoshiRulz 10478e23f1
Remove redundant dir exists checks 2022-08-17 17:35:07 +10:00
YoshiRulz 3f2a07e582
Fix remaining MA0098 code style warnings
"Use indexer instead of LINQ methods"
fixes 17df5673d, forgot I was in the middle of this when I pushed
2022-07-22 04:51:56 +10:00
Thompson Lee 2308ba1ecc
Added "Clear Output" button to Lua Console (squashed PR #3307)
* Added "Clear Output" button to Lua Console tool.
* Swapped out indentation from tabs to space from Line 248 through 249 for consistency.
* Swapped out indentation from tabs to spaces for consistency.
* Added a custom "Clear Console" icon to Bizhawk.
2022-07-08 14:03:13 +10:00
YoshiRulz 206dcaf49b
Refactors for selection in `InputRoll`
also standardises behaviour of Select All and Insert Separator buttons
see e88fa8135
2022-06-30 16:46:28 +10:00
YoshiRulz 725f6e7194
Update TASVideos links for new site, set next release to 2.8 2022-01-10 15:07:06 +10:00
zeromus 45c635ac70 update some urls 2021-10-16 14:38:24 -04:00
YoshiRulz ef059dbcaa
Missed the newline on this print 2021-10-04 08:11:42 +10:00
YoshiRulz 02f23692cf
Re-enable Lua on Linux 2021-10-03 09:48:26 +10:00