<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.cheatengine.org/index.php?action=history&amp;feed=atom&amp;title=Mono%3ALua%3Amono_loadAssemblyFromFile</id>
	<title>Mono:Lua:mono loadAssemblyFromFile - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.cheatengine.org/index.php?action=history&amp;feed=atom&amp;title=Mono%3ALua%3Amono_loadAssemblyFromFile"/>
	<link rel="alternate" type="text/html" href="https://wiki.cheatengine.org/index.php?title=Mono:Lua:mono_loadAssemblyFromFile&amp;action=history"/>
	<updated>2026-05-18T17:34:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>https://wiki.cheatengine.org/index.php?title=Mono:Lua:mono_loadAssemblyFromFile&amp;diff=7587&amp;oldid=prev</id>
		<title>Jgoemat: Added example of how the function can be used</title>
		<link rel="alternate" type="text/html" href="https://wiki.cheatengine.org/index.php?title=Mono:Lua:mono_loadAssemblyFromFile&amp;diff=7587&amp;oldid=prev"/>
		<updated>2025-01-22T03:14:16Z</updated>

		<summary type="html">&lt;p&gt;Added example of how the function can be used&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This can be used to load an external mono assembly from a file, which you can then access&lt;br /&gt;
like an assembly from the game.&lt;br /&gt;
&lt;br /&gt;
As an example, you could create a new class library project in Visual Studio and reference&lt;br /&gt;
the assemblies from the folder for the game &amp;quot;Our Adventurer's Guild&amp;quot; and create a class&lt;br /&gt;
like this.   This has a method that can be called in place of the game's &amp;quot;CraftingWindowUI:CheckCraftable&amp;quot;&lt;br /&gt;
method and skips the checks it does for inventory and only enables the button and calls&lt;br /&gt;
the UpdateUI() method called in the original method to make it visible.  A program called&lt;br /&gt;
'dnspy' is useful for examining the game's &amp;quot;Assembly-CSharp.dll&amp;quot; assembly and finding out&lt;br /&gt;
what the game code does.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
namespace MyGuild&lt;br /&gt;
{&lt;br /&gt;
    public static class CraftingWindowExtensions&lt;br /&gt;
    {&lt;br /&gt;
        public static void CheckCraftable(this CraftingWindowUI ui)&lt;br /&gt;
        {&lt;br /&gt;
            ui.CraftButton.interactable = true;&lt;br /&gt;
            ui.CraftPrompt.UpdateUI();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then an autoassembly script table entery can be created to load the DLL into the game's process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[enable]&lt;br /&gt;
{$lua}&lt;br /&gt;
mono_loadAssemblyFromFile(&amp;quot;C:\\git\\MyGuild\\bin\\Debug\\MyGuild.dll&amp;quot;)&lt;br /&gt;
{$asm}&lt;br /&gt;
&lt;br /&gt;
[disable]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then another autoassembly script table entry can be created that will inject a jmp into&lt;br /&gt;
the game's original code to call the replacement method instead:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
define(hook,&amp;quot;CraftingWindowUI:CheckCraftable&amp;quot;)&lt;br /&gt;
define(bytes,55 48 8B EC 48 81 EC 80 00 00 00 48 89 75 F0)&lt;br /&gt;
&lt;br /&gt;
[enable]&lt;br /&gt;
assert(hook, bytes)&lt;br /&gt;
&lt;br /&gt;
hook:&lt;br /&gt;
  jmp far MyGuild.CraftingWindowExtensions.CheckCraftable&lt;br /&gt;
&lt;br /&gt;
[disable]&lt;br /&gt;
&lt;br /&gt;
hook:&lt;br /&gt;
  db bytes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jgoemat</name></author>
		
	</entry>
</feed>