Changeset 84
- Timestamp:
- Jul 19, 2014, 12:47:32 PM (10 years ago)
- Location:
- binary-improvements
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r83 r84 31 31 <Reference Include="System" /> 32 32 <Reference Include="Assembly-CSharp"> 33 <HintPath>..\ NamePatcher\bin\Release\Assembly-CSharp.dll</HintPath>33 <HintPath>..\assembly-patcher\bin\Release\Assembly-CSharp.dll</HintPath> 34 34 </Reference> 35 35 <Reference Include="UnityEngine"> … … 46 46 <Compile Include="src\TelnetCommands\SayToPlayer.cs" /> 47 47 <Compile Include="src\AllocsLogFunctions.cs" /> 48 <Compile Include="src\TelnetCommands\SetTimeReal.cs" /> 49 <Compile Include="src\AdminToolsStuff.cs" /> 48 50 </ItemGroup> 49 51 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
binary-improvements/7dtd-server-fixes/src/AllocsNetTelnetServer.cs
r83 r84 137 137 console.AddCommand(new ListPlayersExtended(console)); 138 138 console.AddCommand(new SayToPlayer(console)); 139 console.AddCommand(new SetTimeReal(console)); 139 140 } 140 141 -
binary-improvements/7dtd-server-fixes/src/TelnetCommands/GetTime.cs
r77 r84 26 26 hour -= 24; 27 27 } 28 int sec= (int)(time % 1000) * 60 / 1000;29 m_Console.md000a (String.Format ("Day {0}, {1:00}:{2:00} ", day, hour, sec));28 int min = (int)(time % 1000) * 60 / 1000; 29 m_Console.md000a (String.Format ("Day {0}, {1:00}:{2:00} ", day, hour, min)); 30 30 } 31 31 } -
binary-improvements/NamePatcher/NamePatcher.cs
r83 r84 58 58 static void applyManualPatches (ModuleDefinition mainModule) 59 59 { 60 foreach (FieldDefinition fd in mainModule.GetType ("AdminTools").Fields) { 61 TypeReference fdType = fd.FieldType; 62 if (fdType.FullName.Contains ("List") && fdType.FullName.Contains ("AdminToolsCommandPermissions")) { 63 Console.WriteLine ("Renaming and making public admin tools field -> commandPermissions"); 64 fd.Attributes = fd.Attributes & (~Mono.Cecil.FieldAttributes.Private) | Mono.Cecil.FieldAttributes.Public; 65 NameNormalizer.setName (fd, "commandPermissions"); 66 } 67 } 68 60 69 foreach (FieldDefinition fd in mainModule.GetType ("World").Fields) { 61 70 TypeReference fdType = fd.FieldType; -
binary-improvements/NamePatcher/NamePatcher.userprefs
r77 r84 3 3 <MonoDevelop.Ide.Workbench ActiveDocument="NamePatcher.cs"> 4 4 <Files> 5 <File FileName="NamePatcher.cs" Line="1 65" Column="120" />5 <File FileName="NamePatcher.cs" Line="109" Column="57" /> 6 6 <File FileName="NameNormalizer.cs" Line="188" Column="1" /> 7 7 </Files> -
binary-improvements/assembly-patcher/Assembly-Patcher.userprefs
r83 r84 3 3 <MonoDevelop.Ide.Workbench ActiveDocument="Main.cs"> 4 4 <Files> 5 <File FileName="Main.cs" Line=" 48" Column="3" />5 <File FileName="Main.cs" Line="29" Column="54" /> 6 6 <File FileName="AssemblyInfo.cs" Line="21" Column="1" /> 7 7 </Files> 8 <Pads> 9 <Pad Id="ProjectPad"> 10 <State expanded="True"> 11 <Node name="Assembly-Patcher" expanded="True"> 12 <Node name="References" expanded="True"> 13 <Node name="/home/ci/Schreibtisch/7dtd-svn/binary-improvements/7dtd-server-fixes/bin/Release/7dtd-server-fixes.dll" selected="True" /> 14 </Node> 15 </Node> 16 </State> 17 </Pad> 18 </Pads> 8 19 </MonoDevelop.Ide.Workbench> 9 20 <MonoDevelop.Ide.DebuggingService.Breakpoints> -
binary-improvements/assembly-patcher/Main.cs
r83 r84 14 14 connectLogPatch (module); 15 15 executionLogPatch( module); 16 publicCommandPermissionsPatch (module); 16 17 module.Write ("Assembly-CSharp.dll"); 17 18 Console.WriteLine ("Done"); 19 } 20 21 private static void publicCommandPermissionsPatch (ModuleDefinition module) 22 { 23 TypeDefinition type = module.GetType ("AdminTools"); 24 25 if (isPatched (type)) { 26 return; 27 } 28 29 markTypePatched (module, type); 30 replaceMethod (type, "GetAllowedCommandsList", true, 1, typeof(AdminToolsStuff).GetMethod ("GetAllowedCommandsList")); 18 31 } 19 32 … … 51 64 52 65 markTypePatched (module, type); 53 replaceMethod (type, ".ctor", 1, typeof(AllocsNetTelnetServer).GetMethod ("init"));54 replaceMethod (type, "Disconnect", 0, typeof(AllocsNetTelnetServer).GetMethod ("Disconnect"));55 replaceMethod (type, "SetConsole", 1, typeof(AllocsNetTelnetServer).GetMethod ("SetConsole"));56 replaceMethod (type, "WriteToClient", 1, typeof(AllocsNetTelnetServer).GetMethod ("WriteToClient"));66 replaceMethod (type, ".ctor", false, 1, typeof(AllocsNetTelnetServer).GetMethod ("init")); 67 replaceMethod (type, "Disconnect", false, 0, typeof(AllocsNetTelnetServer).GetMethod ("Disconnect")); 68 replaceMethod (type, "SetConsole", false, 1, typeof(AllocsNetTelnetServer).GetMethod ("SetConsole")); 69 replaceMethod (type, "WriteToClient", false, 1, typeof(AllocsNetTelnetServer).GetMethod ("WriteToClient")); 57 70 } 58 71 … … 92 105 } 93 106 94 private static void replaceMethod (TypeDefinition type, string methodName, int opCount, MethodBase targetMethod)107 private static void replaceMethod (TypeDefinition type, string methodName, bool addThisRef, int opCount, MethodBase targetMethod) 95 108 { 96 109 foreach (MethodDefinition method in type.Methods) { … … 100 113 var call = il.Create (OpCodes.Call, method.Module.Import (targetMethod)); 101 114 var i = 0; 115 if (addThisRef) 116 il.InsertBefore (method.Body.Instructions [i++], il.Create (OpCodes.Ldarg, 0)); 102 117 for (int op = 0; op < opCount; op++) { 103 118 il.InsertBefore (method.Body.Instructions [i++], il.Create (OpCodes.Ldarg, op + 1));
Note:
See TracChangeset
for help on using the changeset viewer.