Commit Graph

20110 Commits

Author SHA1 Message Date
YoshiRulz df4df517b8 Add `IMovieApi.PlayFromStart`/`movie.play_from_start` (resolves #384) 2022-12-07 18:16:13 +10:00
YoshiRulz 7fdc3f992d Propagate success through to caller for movie load/restart 2022-12-07 18:16:13 +10:00
YoshiRulz 0076c8802b Add `saveChanges` parameter to `IMovieApi.Stop`/`movie.stop` 2022-12-07 18:16:13 +10:00
YoshiRulz e0a7a39b0d Have `IMovieApi.Stop` implementation use `MainForm.StopMovie` 2022-12-07 18:16:13 +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 a8e0192281
Use FLPs so UI scale doesn't break Record Movie dialog (see #2605)
disables resizing the dialog; default is big enough and the `TextBox`es can
scroll
2022-12-07 15:43:25 +10:00
YoshiRulz 632f063073
Cleanup `RecordMovie` ctor 2022-12-07 15:43:24 +10:00
YoshiRulz 400b1b589b
Inline `RecordMovie.InitializeComponent` (Designer file) 2022-12-07 15:43:21 +10:00
YoshiRulz 102874e480
Fix N64 header detection being swapped (fixes #3477)
fixes abeaa2a10
how ironic
2022-12-07 14:34:52 +10:00
YoshiRulz 62f6f3b471
Fix Win32LuaLibraries init'ing incorrectly on `DeveloperBuild = false` 2022-12-07 14:27:19 +10:00
CasualPokePlayer b04260bee7 fix unwrapped lua exceptions not being correctly thrown 2022-12-06 14:21:39 -08:00
YoshiRulz def5df44fa
Fix double call to `UIHelper.ScaleX` in `ControllerConfig` (see #2605)
fixes 93c47b87b
2022-12-07 05:29:27 +10:00
Morilli 5e6c4a2bbd fix justifier controller never working oops 2022-12-06 19:42:30 +01:00
Morilli 96cc3f8745 BSNESv115: implement an extended gamepad controller with 4 extra buttons
this is a breaking change for existing movies, but only when a non-gamepad controller was used, which is rare
2022-12-06 19:21:08 +01:00
CasualPokePlayer 339994c5a7 change these to using var 2022-12-06 09:46:12 -08:00
CasualPokePlayer b687dea1b0 change every IntPtr<->int cast to IntPtr<->long. we got 64 bit integers with lua now, and a pointer is 64 bits, so might avoid some dumb bug due to truncations and some ungodly amount of ram being used
TODO: see if we can skip this cast nonsense. the lua tests indicate IntPtr should pass through fine, being considered "userdata", probably better so the user can't just pass raw numbers for the handle.
2022-12-06 04:53:35 -08:00
CasualPokePlayer bc79664461 fix implicit lua number to .net conversion
fix .net exceptions not halting the running script
fix inconsistency with stdout and lua console printing errors, both should end in a newline now
print the inner exception of a lua exception (i.e. the .net extension) if possible
2022-12-06 02:52:57 -08:00
CasualPokePlayer eb00019c86 fix passing numbers for string args in .net lua functions (old engine had this behavior, granted "bad user" if they relied on this), add appropriate test
fix passing sbyte/char as args, add appropriate tests
cleanup the lua auto unlock hack, using a nice ref struct + dispose to handle it
2022-12-05 23:21:23 -08:00
CasualPokePlayer 920682688b deprecate lua bit functions which have direct operator counterparts in new lua 2022-12-05 18:23:11 -08:00
CasualPokePlayer dcd570bf87 fix mainmemory.write_bytes_as_dict 2022-12-05 16:46:22 -08:00
Morilli 4a49fc174b Improve LsmvImport in numerous ways
- previously, every second frame was empty (lol), since 2016 i believe
- now imports as (sub)bsnes115 movie instead of bsnes, allowing to import subframe inputs and delayed resets
- imports controller types correct(er)ly
2022-12-05 16:28:22 +01:00
Morilli 10ba45d462 BSNESv115+: actually provide IBoardInfo properly 2022-12-04 22:48:29 +01:00
YoshiRulz abeaa2a106
Be less lazy about N64 header detection in byteswapper
fixes 82c3b471a, 9660c16a0
2022-12-05 04:54:19 +10:00
CasualPokePlayer 9660c16a0a fix N64 roms coming through multidisk bundler in ares 2022-12-04 01:35:58 -08:00
CasualPokePlayer 3dd36f5f07 revert the explicit try/finally use for PeekByte/PokeByte monitor domain methods, testing seems to show the ref struct use makes EnterExit allocation (now forced to the stack) a non-issue performance wise 2022-12-03 18:30:09 -08:00
CasualPokePlayer f01463e2b3 Convert EnterExitWrapper to a readonly ref struct, this should be a speedup in all cases. Will need to experiment to see if this mean the try/finally from #3296 can be avoided 2022-12-03 17:46:49 -08:00
YoshiRulz d508b734d6
Fix `MemoryApi.{Read,Write}ByteRange` edge cases 2022-12-04 09:23:28 +10:00
YoshiRulz af44a85cfd
Add unit tests for `IMemoryApi.{Read,Write}ByteRange` 2022-12-04 09:23:28 +10:00
YoshiRulz dc4efc3644
Fix typos and whitespace in `MemoryApi.cs` 2022-12-04 09:23:27 +10:00
YoshiRulz 1bdff05442
Use read-only collection types in `IMemoryApi` 2022-12-04 09:23:25 +10:00
YoshiRulz cba206efec
Add `IUserDataApi.Keys`/`userdata.get_keys` 2022-12-04 04:06:58 +10:00
YoshiRulz c2d5a9c931 Banish empty conditional blocks 2022-12-04 02:11:41 +10:00
YoshiRulz 84d2866f53
Clean up usage of `LuaFile.Enabled`/`Paused` 2022-12-04 01:43:02 +10:00