Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d9ef60d
Client manager components
Equinox- Aug 22, 2017
2c7b522
Proper delegate naming
Equinox- Aug 22, 2017
4b2fee7
Offline mode fallbacks for the chat manager.
Equinox- Aug 23, 2017
140000d
Test-time reflected event checker
Equinox- Aug 25, 2017
a36e8a4
Merge branch 'staging' into session-mgr-cmp
Equinox- Sep 10, 2017
aa784c1
Null protection in multiplayer manager detach
Equinox- Sep 10, 2017
9d8988a
MyLog logs to the Torch logging system
Equinox- Sep 11, 2017
b42d43c
Redirect Keen console to Info, all else to trace.
Equinox- Sep 11, 2017
0073e10
Fixed issues with operand replacing, and branch instructions.
Equinox- Sep 11, 2017
e57f885
Log errors in ReflectedManager
Equinox- Sep 11, 2017
57acb27
Don't crash when modifying constructor
Equinox- Sep 12, 2017
0810e76
Once the game is created we can patch it with impunity.
Equinox- Sep 12, 2017
b1145c8
Utility method to invert common load and store instructions
Equinox- Sep 12, 2017
373c476
Better guessing on the generic operand type
Equinox- Sep 12, 2017
a61b646
ReflectedMethodInfo allows non-public type names.
Equinox- Sep 12, 2017
5eceb21
Comments
Equinox- Sep 12, 2017
96f813a
IMultiplayerManager: added list of banned steam ID's
jimmble Sep 20, 2017
d8e2072
documentation added
jimmble Sep 20, 2017
f1fc49d
Merge branch 'staging' into session-mgr-cmp
jimmble Sep 20, 2017
eb7f7f4
MultiplayerManagerLobby doesn't implement IMultiplayerManagerServer
jimmble Sep 20, 2017
9c505c4
banned player list made readonly, lobby fakes support
jimmble Sep 20, 2017
205dd1a
Merge pull request #120 from blaho/session-mgr-cmp
Equinox- Sep 20, 2017
0574d59
Merge branch 'staging' into session-mgr-cmp
Equinox- Sep 22, 2017
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Better guessing on the generic operand type
  • Loading branch information
Equinox- committed Sep 12, 2017
commit 373c476d2d43e5595987d641e4e45ccc16a2e887
2 changes: 1 addition & 1 deletion NLog.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<rules>
<logger name="*" minlevel="Info" writeTo="main, console" />
<logger name="Chat" minlevel="Info" writeTo="chat" />
<!--<logger name="Torch.Managers.PatchManager.*" minlevel="Trace" writeTo="patch"/>-->
<logger name="Torch.Managers.PatchManager.*" minlevel="Trace" writeTo="patch"/>
</rules>
</nlog>
22 changes: 22 additions & 0 deletions Torch/Managers/PatchManager/MSIL/MsilInstruction.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
Expand Down Expand Up @@ -103,6 +105,9 @@ public MsilInstruction(OpCode opcode)
/// </summary>
public HashSet<MsilLabel> Labels { get; } = new HashSet<MsilLabel>();


private static readonly ConcurrentDictionary<Type, PropertyInfo> _setterInfoForInlines = new ConcurrentDictionary<Type, PropertyInfo>();

/// <summary>
/// Sets the inline value for this instruction.
/// </summary>
Expand All @@ -111,6 +116,23 @@ public MsilInstruction(OpCode opcode)
/// <returns>This instruction</returns>
public MsilInstruction InlineValue<T>(T o)
{
Type type = typeof(T);
while (type != null)
{
if (!_setterInfoForInlines.TryGetValue(type, out PropertyInfo target))
{
Type genType = typeof(MsilOperandInline<>).MakeGenericType(type);
target = genType.GetProperty(nameof(MsilOperandInline<int>.Value));
_setterInfoForInlines[type] = target;
}
Debug.Assert(target?.DeclaringType != null);
if (target.DeclaringType.IsInstanceOfType(Operand))
{
target.SetValue(Operand, o);
return this;
}
type = type.BaseType;
}
((MsilOperandInline<T>)Operand).Value = o;
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion Torch/Managers/PatchManager/Transpile/MethodContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void CheckIntegrity()

public string ToHumanMsil()
{
return string.Join("\n", _instructions.Select(x => $"IL_{x.Offset:X4}: {x.StackChange()} {x}"));
return string.Join("\n", _instructions.Select(x => $"IL_{x.Offset:X4}: {x.StackChange():+0;-#} {x}"));
}

private static readonly Dictionary<short, OpCode> OpCodeLookup;
Expand Down
4 changes: 2 additions & 2 deletions Torch/Managers/PatchManager/Transpile/MethodTranspiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ internal static void Transpile(MethodBase baseMethod, IEnumerable<MethodInfo> tr
var context = new MethodContext(baseMethod);
context.Read();
context.CheckIntegrity();
_log.Trace("Input Method:");
_log.Trace(context.ToHumanMsil);
// _log.Trace("Input Method:");
// _log.Trace(context.ToHumanMsil);

var methodContent = (IEnumerable<MsilInstruction>)context.Instructions;
foreach (var transpiler in transpilers)
Expand Down