Re: Two Point Hospital
Posted: Sat Mar 19, 2022 3:28 pm
At this moment is 1.29.40
Community Cheat Tables of Cheat Engine
https://fearlessrevolution.com/
This guide is still workable and possible to follow. I no longer have TPH installed but if you follow the instructions above, you will be able to patch your own Assembly-CSharps every time the game updates.koderkrazy wrote: ↑Thu Oct 25, 2018 3:51 amThere 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.
ConsoleController consoleController = UnityEngine.Object.FindObjectOfType<ConsoleController>();
consoleController.ToggleKey = KeyCode.None;
UnityEngine.Object.FindObjectOfType<ConsoleController>()
(still ends with KeyCode.None; tho)Does anyone know if it's possible to use this to get access to the DebugAddPrimeEntitlement() function?Alraya wrote: ↑Sat Mar 25, 2023 11:28 amThis guide is still workable and possible to follow. I no longer have TPH installed but if you follow the instructions above, you will be able to patch your own Assembly-CSharps every time the game updates.koderkrazy wrote: ↑Thu Oct 25, 2018 3:51 amThere 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.
The only difference is that
ConsoleController consoleController = UnityEngine.Object.FindObjectOfType<ConsoleController>();
consoleController.ToggleKey = KeyCode.None;
has changed to something shorter a while back, just search for a line withUnityEngine.Object.FindObjectOfType<ConsoleController>()
(still ends with KeyCode.None; tho)
and the lines to replace with NOP are like 100-150 lines lower and shortened to just 3 lines.
The commands registering should be unchanged.
I can't find a version with an .exe! That link is broken and the only stuff I can find is on Github!Alraya wrote: ↑Sat Mar 25, 2023 11:28 amThis guide is still workable and possible to follow. I no longer have TPH installed but if you follow the instructions above, you will be able to patch your own Assembly-CSharps every time the game updates.koderkrazy wrote: ↑Thu Oct 25, 2018 3:51 amThere 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.
The only difference is that
ConsoleController consoleController = UnityEngine.Object.FindObjectOfType<ConsoleController>();
consoleController.ToggleKey = KeyCode.None;
has changed to something shorter a while back, just search for a line withUnityEngine.Object.FindObjectOfType<ConsoleController>()
(still ends with KeyCode.None; tho)
and the lines to replace with NOP are like 100-150 lines lower and shortened to just 3 lines.
The commands registering should be unchanged.