Commit Graph

40 Commits

Author SHA1 Message Date
EvilFactory
245e76cd8d Fix #106 turn list into an array before looping through hooks 2022-09-23 11:42:49 -03:00
peelz
cc414692be Change Hook.Patch exceptions to lua errors 2022-09-17 00:11:09 -04:00
peelz
6da732e997 Fix Hook.Patch confusing .ctor with .cctor 2022-09-17 00:11:09 -04:00
peelz
2cdd3f3ec5 Add constructor support to Hook.Patch 2022-09-15 19:31:47 -04:00
peelz
025b840625 Fix test concurrency issues 2022-09-15 19:31:41 -04:00
peelz
d547c97c80 Fix Hook.Add compatibility with C# mods 2022-08-20 11:32:18 -04:00
peelz
dd1b404c9b Refactor error/exception/message handling
This adds:
- LuaCsSetup.ExceptionHandler so we can decide how we want to handle
exceptions for unit tests
- LuaCsSetup.MessageHandler so we can redirect logs to the XUnit output
  helper
2022-08-10 05:59:41 -04:00
peelz
d9dc84425d Make LuaCsSetup easier to integrate into unit tests 2022-08-09 17:50:00 -04:00
peelz
08836088fb Refactor hooking API
This completely changes how method patching works under the hood. Unlike
the previous API (`Hook.HookMethod`), the new API (`Hook.Patch`)
generates a Harmony patch method at runtime, using IL generation.

This fixes methods with ByRef (out/ref) parameters getting silently corrupted
due to the ByRef semantics being lost when passed through the `object[] __args`
parameter.

This new API also makes it possible to:
  - modify parameters (including ByRef params)
  - change the return value to `null` (old API would use `return nil`
    for Harmony control flow)
  - prevent execution of the original method (and other harmony
    patches), independently of modifying the return value
2022-08-09 17:50:00 -04:00
peelz
768abd5ce1 Remove LuaResult 2022-08-09 17:50:00 -04:00
peelz
a5bffce33b Move prohibitedHooks check to a method 2022-08-09 17:50:00 -04:00
Evil Factory
b9ebf04a6a fix undefined identifiers in patches overriding each other 2022-07-14 20:55:39 -03:00
Evil Factory
aaa27229cf fix error not being handled if name is null 2022-07-03 12:41:15 -03:00
Evil Factory
57032eeb11 whoops 2022-07-03 10:39:42 -03:00
Evil Factory
316f1a5007 improve error handling in Hook 2022-07-03 10:19:41 -03:00
Evil Factory
a6f7a4aff8 fix error handling in patches 2022-07-01 14:14:44 -03:00
Evil Factory
20dabf502a cleanup 2022-06-29 16:48:34 -03:00
Evil Factory
4ad3b2cba0 Decursefication of patches 2022-06-29 16:13:51 -03:00
Evil Factory
64c81146fb added PerformanceCounter 2022-06-19 11:50:51 -03:00
Evil Factory
9041f5ef0d forgot to include a file in the last commit (ed1fbdbe5) 2022-06-09 16:03:36 -03:00
Evil Factory
7951754203 fix some hooks not getting triggered in singleplayer 2022-05-25 13:18:52 -03:00
Evil Factory
7ee81aca24 fix formatting 2022-05-21 12:48:35 -03:00
Evil Factory
e7510cad76 fix Game.RoundStarted and improve error handling 2022-05-07 15:36:47 -03:00
Evil Factory
64f0e2f137 Fixes for PR #80 2022-05-06 13:10:50 -03:00
Evil Factory
72b2492f0d fix patch hooks not working correctly with void return types 2022-04-29 12:10:20 -03:00
Evil Factory
5c34bc8db9 tell patch method name if an error happens 2022-04-28 13:42:22 -03:00
Oiltanker
abe17df121 better LuaCsPatch parameters 2022-04-27 16:40:16 +03:00
Evil Factory
2e14ff79fc fix hook calls not working correctly 2022-04-20 15:38:15 -03:00
Oiltanker
8bcd19a4ff fix the return of LuaResult from hook call 2022-04-18 15:13:32 +03:00
Oiltanker
7458108fc0 fix cs filter metadata bug 2022-04-17 20:39:23 +03:00
Oiltanker
e52f762861 safer HookMethod and more sandboxed cs mods 2022-04-17 19:26:54 +03:00
Oiltanker
a7b4004058 cs script runner + mod store + cs-lua interface 2022-04-17 16:05:00 +03:00
Evil Factory
f439cabc9a fix patch hooks and rename delegates 2022-04-16 12:44:50 -03:00
Evil Factory
b7395bedea Refactor and fix #56 2022-04-15 19:08:27 -03:00
Oiltanker
e4ea88d598 hook addition name case-insensitivity fix 2022-04-15 21:29:14 +03:00
Oiltanker
2f0e83badd hook fixes, keybinds are not working 2022-04-15 21:29:14 +03:00
Oiltanker
3eba20ecb7 new hook call method + function to delegate conversion 2022-04-15 21:29:12 +03:00
Oiltanker
891efb4c4f working host game begin and host game exit 2022-04-15 21:28:24 +03:00
Oiltanker
5d06df437e hook merge + hook wrappers 2022-04-15 21:28:22 +03:00
Oiltanker
1e6ac68e86 initial cs-lua merge work 2022-04-15 21:25:58 +03:00