Skip to content

Commit

Permalink
Refactor RedirectInternalLogs -> MirrorInternalLogs
Browse files Browse the repository at this point in the history
  • Loading branch information
ghorsington committed Jul 14, 2020
1 parent 1628b52 commit be19752
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion BepInEx.Debug.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoProfilerLoader", "src\S
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoProfilerController", "src\simpleprofiler\MonoProfilerController\MonoProfilerController.csproj", "{E643A810-00A8-4B6F-83FC-B8631257EB43}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedirectInternalLogs", "src\RedirectInternalLogs\RedirectInternalLogs.csproj", "{29571930-F2E9-45DC-BB65-5B60C2B16850}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MirrorInternalLogs", "src\MirrorInternalLogs\MirrorInternalLogs.csproj", "{29571930-F2E9-45DC-BB65-5B60C2B16850}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.IO;
using RedirectInternalLogs.Util;
using MirrorInternalLogs.Util;

namespace RedirectInternalLogs
namespace MirrorInternalLogs
{
public enum InternalLogLevel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{29571930-F2E9-45DC-BB65-5B60C2B16850}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RedirectInternalLogs</RootNamespace>
<AssemblyName>RedirectInternalLogs</AssemblyName>
<RootNamespace>MirrorInternalLogs</RootNamespace>
<AssemblyName>MirrorInternalLogs</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
Expand Down Expand Up @@ -72,7 +72,7 @@
<Compile Include="Platforms\IPlatformPatcher.cs" />
<Compile Include="Platforms\X64Patcher.cs" />
<Compile Include="Platforms\X86Patcher.cs" />
<Compile Include="RedirectInternalLogsPatcher.cs" />
<Compile Include="MirrorInternalLogsPatcher.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Util\BytePattern.cs" />
<Compile Include="Util\LibcHelper.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using MirrorInternalLogs.Platforms;
using MirrorInternalLogs.Util;
using Mono.Cecil;
using RedirectInternalLogs.Platforms;
using RedirectInternalLogs.Util;

namespace RedirectInternalLogs
namespace MirrorInternalLogs
{
internal static class RedirectInternalLogsPatcher
internal static class MirrorInternalLogsPatcher
{
internal static ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("RedirectInternalLogs");
internal static ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("MirrorInternalLogs");

private static readonly ConfigFile Config =
new ConfigFile(Path.Combine(Paths.ConfigPath, "RedirectInternalLogs.cfg"), true);
new ConfigFile(Path.Combine(Paths.ConfigPath, "MirrorInternalLogs.cfg"), true);

private static IPlatformPatcher patcher;
private static StreamWriter writer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace RedirectInternalLogs.Platforms
namespace MirrorInternalLogs.Platforms
{
internal interface IPlatformPatcher
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Runtime.InteropServices;
using MirrorInternalLogs.Util;
using MonoMod.RuntimeDetour;
using RedirectInternalLogs.Util;

namespace RedirectInternalLogs.Platforms
namespace MirrorInternalLogs.Platforms
{
internal class X64Patcher : X86Patcher
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using MirrorInternalLogs.Util;
using MonoMod.RuntimeDetour;
using RedirectInternalLogs.Util;

namespace RedirectInternalLogs.Platforms
namespace MirrorInternalLogs.Platforms
{
internal class X86Patcher : IPlatformPatcher
{
Expand Down Expand Up @@ -65,18 +65,18 @@ private unsafe IntPtr FindMatch(IntPtr start, int maxSize)
.FirstOrDefault(m => m.res >= 0);
if (match == null)
{
RedirectInternalLogsPatcher.Logger.LogWarning(
MirrorInternalLogsPatcher.Logger.LogWarning(
"No match found, cannot hook logging! Please report Unity version or game name to the developer!");
return IntPtr.Zero;
}

var ptr = (byte*) start.ToPointer();
RedirectInternalLogsPatcher.Logger.LogDebug($"Found at {match.res:X} ({start.ToInt64() + match.res:X})");
MirrorInternalLogsPatcher.Logger.LogDebug($"Found at {match.res:X} ({start.ToInt64() + match.res:X})");
var offset = *(int*) (ptr + match.res + match.p.Length);
var jmpRva = unchecked((uint) (match.res + match.p.Length + sizeof(int)) + offset);
var addr = start.ToInt64() + jmpRva;
RedirectInternalLogsPatcher.Logger.LogDebug($"Parsed offset: {offset:X}");
RedirectInternalLogsPatcher.Logger.LogDebug(
MirrorInternalLogsPatcher.Logger.LogDebug($"Parsed offset: {offset:X}");
MirrorInternalLogsPatcher.Logger.LogDebug(
$"Jump RVA: {jmpRva:X}, memory address: {addr:X} (image base: {start.ToInt64():X})");
return new IntPtr(addr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RedirectInternalLogs")]
[assembly: AssemblyTitle("MirrorInternalLogs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RedirectInternalLogs")]
[assembly: AssemblyProduct("MirrorInternalLogs")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using System.Linq;

namespace RedirectInternalLogs.Util
namespace MirrorInternalLogs.Util
{
internal class BytePattern
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using MonoMod.Utils;

namespace RedirectInternalLogs.Util
namespace MirrorInternalLogs.Util
{
internal static class LibcHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;

namespace RedirectInternalLogs.Util
namespace MirrorInternalLogs.Util
{
internal static class StringExtensions
{
Expand Down
File renamed without changes.

0 comments on commit be19752

Please sign in to comment.