| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| jgoemat Master Cheater
 
 ![]() Reputation: 23 
 Joined: 25 Sep 2011
 Posts: 264
 
 
 | 
			
				|  Posted: Tue Jan 21, 2025 10:29 pm    Post subject: Request: Mono Compiler |   |  
				| 
 |  
				| I just found the method `mono_loadAssemblyFromFile` which is awesome.   I was able to create a Visual Studio project, reference the game files, and write some code interacting with the game code and call it from a table.   I created the wiki page showing usage: 
 https://wiki.cheatengine.org/index.php?title=Mono:Lua:mono_loadAssemblyFromFile
 
 Something that would be next level awesome would be a method like `mono_compileCSharp(assemblyName, cSharpCode)` that would let you build an assembly from a table and load it into the game without external tools.  Not sure how hard that would be, roslyn is open source, though most of what I find searching is for syntax stuff and not actually building an assembly.   Something that would do that automatically along with referencing the loaded assemblies from the process automatically would be so cool...
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| ParkourPenguin I post too much
 
  Reputation: 152 
 Joined: 06 Jul 2014
 Posts: 4706
 
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Wed Jan 22, 2025 5:16 am    Post subject: |   |  
				| 
 |  
				| dotnetpatch_getAllReferences() returns a table with all references, and a assembly it thinks might be the one. _________________
 
 Do not ask me about online cheats. I don't know any and wont help finding them.
 Like my help? Join me on Patreon so i can keep helping
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| jgoemat Master Cheater
 
 ![]() Reputation: 23 
 Joined: 25 Sep 2011
 Posts: 264
 
 
 | 
			
				|  Posted: Wed Jan 22, 2025 9:57 pm    Post subject: |   |  
				| 
 |  
				| When the hell was that added and why didn't I know about it?  I figured something like that would be in monoscript.lua   
 Just tried it out and it works like a charm!  Many thanks!  Here's a snippet from an AA script:
 
 
 
 
  	  | Code: |  	  | {$lua} if syntaxcheck then return end
 
 local references, core = dotnetpatch_getAllReferences()
 
 local code = [[namespace MyGuild
 {
 public static class CraftingWindowExtensions
 {
 public static void CheckCraftable(this CraftingWindowUI ui)
 {
 ui.CraftButton.interactable = true;
 ui.CraftPrompt.UpdateUI();
 }
 }
 }
 ]]
 
 local assemblyPath = compileCS(code, references, core)
 mono_loadAssemblyFromFile(assemblyPath)
 {$asm}
 
 | 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Thu Jan 23, 2025 5:42 am    Post subject: |   |  
				| 
 |  
				| tip, in .netinfo rightclick on the method of a class and choose "generate patch template for method" 
 
 it's not perfect and more of a proof of concept, but you may like it
 _________________
 
 Do not ask me about online cheats. I don't know any and wont help finding them.
 Like my help? Join me on Patreon so i can keep helping
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Csimbi I post too much
 
  Reputation: 97 
 Joined: 14 Jul 2007
 Posts: 3327
 
 
 | 
			
				|  Posted: Thu Jan 23, 2025 6:04 am    Post subject: |   |  
				| 
 |  
				| Wut? News to me, too. Good news.
 When I said good, I meant awesome.
 Is this in the wiki somewhere with possibly samples how to correctly replace/extend existing code?
 
 Does it work with IL2CPP?
 I'd assume not.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  |