[enable] {$lua} if syntaxcheck then return end LaunchMonoDataCollector() if dotnetdetours==nil then dotnetdetours={} else local di=dotnetdetours['Phone.UnlockAllPhotosMessage'] if di and di.processid==getOpenedProcessID() then --already detoured. Undo first local r,err=autoAssemble(di.disablescript, di.disableinfo) if not r then error(err) else dotnetdetours['Phone.UnlockAllPhotosMessage']=nil end end end local detourinfo={} local csharpscript=[[ using System; using System.Collections.Generic; using CodeStage.AntiCheat.ObscuredTypes; using GameDataEditor; using Newtonsoft.Json; using System.Runtime.CompilerServices; public class patchedPhone : Phone { public void newUnlockAllPhotosMessage() { List list = GameDataLists.Content.messageData.FindAll((GDEMessageData a) => !this.HasUnlockedMessage(a) && a.AttachmentType.Key != "TEXT"); if (list != null) { foreach (GDEMessageData messageData in list) { this.UnlockMessage(messageData); } } } [MethodImpl(MethodImplOptions.NoInlining)] public void oldUnlockAllPhotosMessage() { } } ]] local references, sysfile=dotnetpatch_getAllReferences() --you're free to build your own list local csfile,msg=compileCS(csharpscript, references, sysfile) if csfile==nil then --sometimes having the sysfile causes an issue. Try without csfile,msg=compileCS(csharpscript, references) if csfile==nil then if msg==nil then msg=' (?Unknown error?)' end messageDialog('Compilation error:'..msg, mtError, mbOK) --show compile error in a dialog instead of a lua error only error(msg) end end --still here, c# dll created, now inject and hook local result, disableinfo, disablescript=InjectDotNetDetour(csfile, "Phone::UnlockAllPhotosMessage","patchedPhone::newUnlockAllPhotosMessage","patchedPhone::oldUnlockAllPhotosMessage") if result then detourinfo.disableinfo=di detourinfo.disablescript=disablescript detourinfo.processid=getOpenedProcessID() dotnetdetours['Phone.UnlockAllPhotosMessage']=detourinfo else if disableinfo==nil then disableinfo='no reason' end error('InjectDotNetDetour failed : '..disableinfo) --prevents checking end {$asm} [disable] {$lua} if syntaxcheck then return end if dotnetdetours['Phone.UnlockAllPhotosMessage'] then autoAssemble(dotnetdetours['Phone.UnlockAllPhotosMessage'].disablescript, dotnetdetours['Phone.UnlockAllPhotosMessage'].disableinfo) end {$asm}