Rubyelf wrote: ↑Tue Oct 23, 2018 8:03 pm
...
There is only one line change in each dll. So should be easy to do.
I won't mind people doing it themselves and uploading here.
Here are steps to enable the console.
A. Tools setup:
1. You'll need ILSpy with Reflexil to edit the game C# dlls.
2. Get it from here
[Link]
3. Extract it and run ILSpy.exe
4. Select all and remove all existing opened dlls/entries in left pane.
5. Open both the dlls(Assembly-CSharp.dll and Assembly-CSharp-firstpass.dll)
from \Two Point Hospital\TPH_Data\Managed folder.
Note: open dlls from game installation folder only, because ILSpy referes other dlls near it to decompile code.
B. Enabling console:
1. In ILSpy expand Assembly-CSharp->TH20->App->App(GraphicRaycaster,...)
2. In constructor App(...) we need to remove following code:
ConsoleController consoleController = UnityEngine.Object.FindObjectOfType<ConsoleController>();
consoleController.ToggleKey = KeyCode.None;
3. Select the code and click on Reflexil icon in toolbar(gear wheel icon). It'll open one panel below code.
4. In instructions tab It'll show opcode for the entire method.
5. Around lines 335-339 you'll find opcods(5 lines) for above instructions.
Select them all and right click then select replace with NOP. See image below.
[Link]
6. Now select Assembly-CSharp from left pane, right click and select save as. Save patched file.
C. Registering commands:
1. Developers have removed code that registers commands. To register commands we need to add the code back again.
2. In left pane now select Assembly-CSharp-firstpass->UnityConsole->ConsoleCommandDatabase->RegisterCommand(String,...)
3. In Reflexil's instruction tab, right click and select opction 'Replace all with code...'. It'll open compile window.
4. On bottom select Compile profile 'UnitySilverLight'.
5. In the method paste this line:
Database[command] = new ConsoleCommand(command, description, usage, callback);
See image below.
[Link]
6. Now click on compile. It enables Ok button. Click on Ok. Note: If you get compile error then do google for solution.
7. In left pane select Assembly-CSharp-firstpass and right click-> select 'save as'. Save patched dll.