Various poorly-written examples on using Mono embedded framework from: https://www.unknowncheats.me/forum/unity/603179-hacking-mono-games.html This code all needs to be re-written if it is to be useful in future projects; it is terrible :)
| 1090 | // it is terrible :) |
| 1091 | // |
| 1092 | static |
| 1093 | bool LoadMonoAssembly (const char* assemblyName) |
| 1094 | { |
| 1095 | MonoImage* pImage = |
| 1096 | SK_mono_image_loaded (assemblyName); |
| 1097 | |
| 1098 | if (pImage != nullptr) |
| 1099 | return true; |
| 1100 | |
| 1101 | MonoDomain* pDomain = |
| 1102 | SK_Unity_MonoDomain; |
| 1103 | |
| 1104 | if (pDomain == nullptr) |
| 1105 | { |
| 1106 | pDomain = SK_mono_get_root_domain (); |
| 1107 | |
| 1108 | if (pDomain == nullptr) |
| 1109 | { |
| 1110 | return false; |
| 1111 | } |
| 1112 | } |
| 1113 | |
| 1114 | AttachThread (); |
| 1115 | |
| 1116 | MonoAssembly* pAssembly = |
| 1117 | SK_mono_domain_assembly_open (pDomain, assemblyName); |
| 1118 | |
| 1119 | if (pAssembly == nullptr) |
| 1120 | return false; |
| 1121 | |
| 1122 | pImage = |
| 1123 | SK_mono_assembly_get_image (pAssembly); |
| 1124 | |
| 1125 | return |
| 1126 | (pImage != nullptr); |
| 1127 | } |
| 1128 | |
| 1129 | static |
| 1130 | void* GetCompiledMethod (const char* nameSpace, const char* className, const char* methodName, int param_count = 0, const char* assemblyName = "Assembly-CSharp") |
no test coverage detected