Skip to content

Commit 25f91ba

Browse files
committed
Dishonored 2 fix
1 parent 2bdcdf1 commit 25f91ba

File tree

6 files changed

+248
-54
lines changed

6 files changed

+248
-54
lines changed

Cameras/Dishonored2/InjectableGenericCameraSystem/GameConstants.h

Lines changed: 63 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
namespace IGCS::GameSpecific
3131
{
3232
// Mandatory constants to define for a game
33-
#define GAME_NAME "Dishonored 2 (v1.77.9+) or Dishonored: Death of the Outsider (v1.145+)"
34-
#define CAMERA_VERSION "1.0.2"
33+
#define GAME_NAME "Dishonored 2 (v1.77.10+) or Dishonored: Death of the Outsider (v1.145+)"
34+
#define CAMERA_VERSION "1.0.3"
3535
#define CAMERA_CREDITS "Otis_Inf"
3636
#define GAME_WINDOW_TITLE "Dishonored"
3737
#define INITIAL_PITCH_RADIANS 0.0f
@@ -56,49 +56,71 @@ namespace IGCS::GameSpecific
5656
#define WIN_PAUSEONFOCUSLOSS_KEY "AOB_WIN_PAUSEONFOCUSLOSS_KEY"
5757

5858
// StartSession jump offsets to nop, relative from start of function
59-
// v1.77.9
60-
//Dishonored2.exe+A2DD90 - 48 83 EC 28 - sub rsp,28 { 40 }
61-
//Dishonored2.exe+A2DD94 - 48 8B 0D CD2FCE01 - mov rcx,[Dishonored2.exe+2710D68]
62-
//Dishonored2.exe+A2DD9B - 48 85 C9 - test rcx,rcx
63-
//Dishonored2.exe+A2DD9E - 0F84 EB000000 - je Dishonored2.exe+A2DE8F <<< NOP
64-
//Dishonored2.exe+A2DDA4 - 48 8B 01 - mov rax,[rcx]
65-
//Dishonored2.exe+A2DDA7 - FF 90 E8000000 - call qword ptr [rax+000000E8]
66-
//Dishonored2.exe+A2DDAD - 84 C0 - test al,al
67-
//Dishonored2.exe+A2DDAF - 0F85 DA000000 - jne Dishonored2.exe+A2DE8F <<< NOP
68-
//Dishonored2.exe+A2DDB5 - 48 8B 0D AC2FCE01 - mov rcx,[Dishonored2.exe+2710D68]
69-
//Dishonored2.exe+A2DDBC - 48 8B 01 - mov rax,[rcx]
70-
//Dishonored2.exe+A2DDBF - FF 90 F8000000 - call qword ptr [rax+000000F8]
71-
//Dishonored2.exe+A2DDC5 - 84 C0 - test al,al
72-
//Dishonored2.exe+A2DDC7 - 0F85 C2000000 - jne Dishonored2.exe+A2DE8F <<< NOP
73-
//Dishonored2.exe+A2DDCD - 48 8B 0D 942FCE01 - mov rcx,[Dishonored2.exe+2710D68]
74-
//Dishonored2.exe+A2DDD4 - 48 8B 01 - mov rax,[rcx]
75-
//Dishonored2.exe+A2DDD7 - FF 50 40 - call qword ptr [rax+40]
76-
//Dishonored2.exe+A2DDDA - 84 C0 - test al,al
77-
//Dishonored2.exe+A2DDDC - 0F84 AD000000 - je Dishonored2.exe+A2DE8F <<< NOP
78-
//Dishonored2.exe+A2DDE2 - 48 8B 05 371DB702 - mov rax,[Dishonored2.exe+359FB20]
79-
//Dishonored2.exe+A2DDE9 - 48 8D 0D 301DB702 - lea rcx,[Dishonored2.exe+359FB20]
80-
//Dishonored2.exe+A2DDF0 - FF 90 10010000 - call qword ptr [rax+00000110]
81-
//Dishonored2.exe+A2DDF6 - 84 C0 - test al,al
82-
//Dishonored2.exe+A2DDF8 - 0F85 91000000 - jne Dishonored2.exe+A2DE8F <<< NOP
83-
//Dishonored2.exe+A2DDFE - 48 8B 0D 632FCE01 - mov rcx,[Dishonored2.exe+2710D68]
84-
//Dishonored2.exe+A2DE05 - 48 81 C1 C86E1F00 - add rcx,001F6EC8 { 2059976 }
85-
//Dishonored2.exe+A2DE0C - E8 9F4DEAFF - call Dishonored2.exe+8D2BB0
86-
//Dishonored2.exe+A2DE11 - 83 F8 05 - cmp eax,05 { 5 }
87-
//Dishonored2.exe+A2DE14 - 74 79 - je Dishonored2.exe+A2DE8F <<< NOP
88-
//Dishonored2.exe+A2DE16 - E8 A5066EFF - call Dishonored2.exe+10E4C0
89-
//Dishonored2.exe+A2DE1B - 8B 05 B7FE1A03 - mov eax,[Dishonored2.exe+3BDDCD8]
90-
//Dishonored2.exe+A2DE21 - 48 8D 0D 88FE1A03 - lea rcx,[Dishonored2.exe+3BDDCB0]
91-
//Dishonored2.exe+A2DE28 - 33 D2 - xor edx,edx
92-
//Dishonored2.exe+A2DE2A - 89 05 482FCE01 - mov [Dishonored2.exe+2710D78],eax
93-
//Dishonored2.exe+A2DE30 - E8 2B9571FF - call Dishonored2.exe+147360
94-
//Dishonored2.exe+A2DE35 - 48 8D 0D 64B1B602 - lea rcx,[Dishonored2.exe+3598FA0]
95-
//Dishonored2.exe+A2DE3C - B2 01 - mov dl,01 { 1 }
59+
// v1.77.10
60+
//Dishonored2.exe+8B1380 - 48 83 EC 28 - sub rsp,28 { 40 }
61+
//Dishonored2.exe+8B1384 - 48 8B 0D 053F0F03 - mov rcx,[Dishonored2.exe+39A5290]
62+
//Dishonored2.exe+8B138B - 48 85 C9 - test rcx,rcx
63+
//Dishonored2.exe+8B138E - 0F84 FB000000 - je Dishonored2.exe+8B148F <<< NOP
64+
//Dishonored2.exe+8B1394 - 48 8B 01 - mov rax,[rcx]
65+
//Dishonored2.exe+8B1397 - FF 90 E8000000 - call qword ptr [rax+000000E8]
66+
//Dishonored2.exe+8B139D - 84 C0 - test al,al
67+
//Dishonored2.exe+8B139F - 0F85 EA000000 - jne Dishonored2.exe+8B148F <<< NOP
68+
//Dishonored2.exe+8B13A5 - 48 8B 0D E43E0F03 - mov rcx,[Dishonored2.exe+39A5290]
69+
//Dishonored2.exe+8B13AC - 48 8B 01 - mov rax,[rcx]
70+
//Dishonored2.exe+8B13AF - FF 90 F8000000 - call qword ptr [rax+000000F8]
71+
//Dishonored2.exe+8B13B5 - 84 C0 - test al,al
72+
//Dishonored2.exe+8B13B7 - 0F85 D2000000 - jne Dishonored2.exe+8B148F <<< NOP
73+
//Dishonored2.exe+8B13BD - 48 8B 0D CC3E0F03 - mov rcx,[Dishonored2.exe+39A5290]
74+
//Dishonored2.exe+8B13C4 - 48 8B 01 - mov rax,[rcx]
75+
//Dishonored2.exe+8B13C7 - FF 50 40 - call qword ptr [rax+40]
76+
//Dishonored2.exe+8B13CA - 84 C0 - test al,al
77+
//Dishonored2.exe+8B13CC - 0F84 BD000000 - je Dishonored2.exe+8B148F <<< NOP
78+
//Dishonored2.exe+8B13D2 - 48 8B 0D 97B9A401 - mov rcx,[Dishonored2.exe+22FCD70]
79+
//Dishonored2.exe+8B13D9 - 48 8B 01 - mov rax,[rcx]
80+
//Dishonored2.exe+8B13DC - FF 90 10010000 - call qword ptr [rax+00000110]
81+
//Dishonored2.exe+8B13E2 - 84 C0 - test al,al
82+
//Dishonored2.exe+8B13E4 - 0F85 A5000000 - jne Dishonored2.exe+8B148F <<< NOP
83+
//Dishonored2.exe+8B13EA - 48 8B 0D 9F3E0F03 - mov rcx,[Dishonored2.exe+39A5290]
84+
//Dishonored2.exe+8B13F1 - 48 81 C1 C86E1F00 - add rcx,001F6EC8 { 2059976 }
85+
//Dishonored2.exe+8B13F8 - E8 3375EDFF - call Dishonored2.exe+788930
86+
//Dishonored2.exe+8B13FD - 83 F8 05 - cmp eax,05 { 5 }
87+
//Dishonored2.exe+8B1400 - 0F84 89000000 - je Dishonored2.exe+8B148F <<< NOP
88+
//Dishonored2.exe+8B1406 - 48 8B 0D EB589D01 - mov rcx,[Dishonored2.exe+2286CF8]
89+
//Dishonored2.exe+8B140D - E8 BE1E82FF - call Dishonored2.exe+D32D0
90+
//Dishonored2.exe+8B1412 - 8B 05 D0AA0C03 - mov eax,[Dishonored2.exe+397BEE8]
91+
//Dishonored2.exe+8B1418 - 48 8D 0D A1AA0C03 - lea rcx,[Dishonored2.exe+397BEC0]
92+
//Dishonored2.exe+8B141F - 41 B0 01 - mov r8b,01 { 1 }
93+
//Dishonored2.exe+8B1422 - 33 D2 - xor edx,edx
94+
//Dishonored2.exe+8B1424 - 89 05 7E3E0F03 - mov [Dishonored2.exe+39A52A8],eax
95+
//Dishonored2.exe+8B142A - E8 A12D85FF - call Dishonored2.exe+1041D0
96+
//Dishonored2.exe+8B142F - 41 B0 01 - mov r8b,01 { 1 }
97+
//Dishonored2.exe+8B1432 - 48 8D 0D A73FA402 - lea rcx,[Dishonored2.exe+32F53E0]
98+
//Dishonored2.exe+8B1439 - 41 0FB6 D0 - movzx edx,r8b
99+
//Dishonored2.exe+8B143D - E8 CE2985FF - call Dishonored2.exe+103E10
100+
//Dishonored2.exe+8B1442 - 83 3D 3F40A402 00 - cmp dword ptr [Dishonored2.exe+32F5488],00
101+
//Dishonored2.exe+8B1449 - 41 B0 01 - mov r8b,01 { 1 }
102+
//Dishonored2.exe+8B144C - 48 8D 0D 0D40A402 - lea rcx,[Dishonored2.exe+32F5460]
103+
//Dishonored2.exe+8B1453 - 41 0FB6 D0 - movzx edx,r8b
104+
//Dishonored2.exe+8B1457 - 0F95 05 4E3E0F03 - setne byte ptr [Dishonored2.exe+39A52AC] { (0) }
105+
//Dishonored2.exe+8B145E - E8 AD2985FF - call Dishonored2.exe+103E10
106+
//Dishonored2.exe+8B1463 - 48 8B 0D 76A69D01 - mov rcx,[Dishonored2.exe+228BAE0] { (7FF6B8E1BB00) }
107+
//Dishonored2.exe+8B146A - 48 8D 15 2F2E3E01 - lea rdx,[Dishonored2.exe+1C942A0] { ("Ansel_PlayerVisible 0") }
108+
//Dishonored2.exe+8B1471 - 48 8B 01 - mov rax,[rcx]
109+
//Dishonored2.exe+8B1474 - FF 50 48 - call qword ptr [rax+48]
110+
//Dishonored2.exe+8B1477 - C6 05 1E3E0F03 01 - mov byte ptr [Dishonored2.exe+39A529C],01 { (0),1 }
111+
//Dishonored2.exe+8B147E - C6 05 193E0F03 01 - mov byte ptr [Dishonored2.exe+39A529E],01 { (0),1 }
112+
//Dishonored2.exe+8B1485 - B8 01000000 - mov eax,00000001 { 1 }
113+
//Dishonored2.exe+8B148A - 48 83 C4 28 - add rsp,28 { 40 }
114+
//Dishonored2.exe+8B148E - C3 - ret
115+
//Dishonored2.exe+8B148F - 33 C0 - xor eax,eax
116+
//Dishonored2.exe+8B1491 - 48 83 C4 28 - add rsp,28 { 40 }
117+
//Dishonored2.exe+8B1495 - C3 - ret
96118
#define STARTSESSION_JMP_OFFSET1 0xE
97119
#define STARTSESSION_JMP_OFFSET2 0x1F
98120
#define STARTSESSION_JMP_OFFSET3 0x37
99121
#define STARTSESSION_JMP_OFFSET4 0x4C
100-
#define STARTSESSION_JMP_OFFSET5 0x68
101-
#define STARTSESSION_JMP_OFFSET6 0x84
122+
#define STARTSESSION_JMP_OFFSET5 0x64
123+
#define STARTSESSION_JMP_OFFSET6 0x80
102124

103125

104126
// Indices in the structures read by interceptors

Cameras/Dishonored2/InjectableGenericCameraSystem/InjectableGenericCameraSystem.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@
2929
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
3030
<ConfigurationType>DynamicLibrary</ConfigurationType>
3131
<UseDebugLibraries>true</UseDebugLibraries>
32-
<PlatformToolset>v142</PlatformToolset>
32+
<PlatformToolset>v143</PlatformToolset>
3333
<CharacterSet>Unicode</CharacterSet>
3434
</PropertyGroup>
3535
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
3636
<ConfigurationType>DynamicLibrary</ConfigurationType>
3737
<UseDebugLibraries>false</UseDebugLibraries>
38-
<PlatformToolset>v142</PlatformToolset>
38+
<PlatformToolset>v143</PlatformToolset>
3939
<WholeProgramOptimization>true</WholeProgramOptimization>
4040
<CharacterSet>Unicode</CharacterSet>
4141
</PropertyGroup>
4242
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
4343
<ConfigurationType>DynamicLibrary</ConfigurationType>
4444
<UseDebugLibraries>true</UseDebugLibraries>
45-
<PlatformToolset>v142</PlatformToolset>
45+
<PlatformToolset>v143</PlatformToolset>
4646
<CharacterSet>Unicode</CharacterSet>
4747
</PropertyGroup>
4848
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4949
<ConfigurationType>DynamicLibrary</ConfigurationType>
5050
<UseDebugLibraries>false</UseDebugLibraries>
51-
<PlatformToolset>v142</PlatformToolset>
51+
<PlatformToolset>v143</PlatformToolset>
5252
<WholeProgramOptimization>true</WholeProgramOptimization>
5353
<CharacterSet>Unicode</CharacterSet>
5454
</PropertyGroup>

Cameras/Dishonored2/InjectableGenericCameraSystem/InterceptorHelper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ namespace IGCS::GameSpecific::InterceptorHelper
4848
{
4949
// AOBs in hostimage
5050
aobBlocks[ANSEL_START_SESSION_KEY] = new AOBBlock(ANSEL_START_SESSION_KEY, "48 83 EC 28 48 8B 0D ?? ?? ?? ?? 48 85 C9 0F 84 ?? ?? ?? ?? 48 8B 01 FF 90 ?? ?? ?? ?? 84 C0", 1);
51-
aobBlocks[ANSEL_STOP_SESSION_KEY] = new AOBBlock(ANSEL_STOP_SESSION_KEY, "48 83 EC 68 48 C7 44 24 30 FE FF FF FF 8B 15 ?? ?? ?? ?? 48 8D 4C 24 38", 1);
52-
aobBlocks[ANSEL_SETUP_UPDATECAMERA_KEY] = new AOBBlock(ANSEL_SETUP_UPDATECAMERA_KEY, "F3 0F 11 05 ?? ?? ?? ?? F3 0F 10 83 ?? ?? ?? ?? F3 0F 11 05 | ?? ?? ?? ?? F3 0F 10 8B ?? ?? ?? ?? F3 0F 11 0D ?? ?? ?? ?? F3 0F 10 83 ?? ?? ?? ?? F3 0F 10 4D 97", 1);
53-
aobBlocks[WIN_PAUSEONFOCUSLOSS_KEY] = new AOBBlock(WIN_PAUSEONFOCUSLOSS_KEY, "84 C0 75 ?? 83 3D | ?? ?? ?? ?? 00 74 ?? 48 8B 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? FF 90", 1);
51+
aobBlocks[ANSEL_STOP_SESSION_KEY] = new AOBBlock(ANSEL_STOP_SESSION_KEY, "48 83 EC 28 8B 15 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? 41 B0 01 E8", 1);
52+
aobBlocks[ANSEL_SETUP_UPDATECAMERA_KEY] = new AOBBlock(ANSEL_SETUP_UPDATECAMERA_KEY, "F3 0F 11 05 | ?? ?? ?? ?? F3 0F 10 8F ?? 3A 00 00 F3 0F 11 0D ?? ?? ?? ?? F3 0F 10 87 ?? 3A 00 00", 1);
53+
aobBlocks[WIN_PAUSEONFOCUSLOSS_KEY] = new AOBBlock(WIN_PAUSEONFOCUSLOSS_KEY, "83 3D | ?? ?? ?? ?? 00 74 4E 48 8B 0D ?? ?? ?? ?? 48 8B 01", 1);
5454

5555
map<string, AOBBlock*>::iterator it;
5656
bool result = true;
@@ -104,7 +104,7 @@ namespace IGCS::GameSpecific::InterceptorHelper
104104
GameImageHooker::nopRange(aobBlocks[ANSEL_START_SESSION_KEY]->absoluteAddress() + STARTSESSION_JMP_OFFSET3, 6);
105105
GameImageHooker::nopRange(aobBlocks[ANSEL_START_SESSION_KEY]->absoluteAddress() + STARTSESSION_JMP_OFFSET4, 6);
106106
GameImageHooker::nopRange(aobBlocks[ANSEL_START_SESSION_KEY]->absoluteAddress() + STARTSESSION_JMP_OFFSET5, 6);
107-
GameImageHooker::nopRange(aobBlocks[ANSEL_START_SESSION_KEY]->absoluteAddress() + STARTSESSION_JMP_OFFSET6, 2);
107+
GameImageHooker::nopRange(aobBlocks[ANSEL_START_SESSION_KEY]->absoluteAddress() + STARTSESSION_JMP_OFFSET6, 6);
108108

109109
// switch off win_pauseOnLossOfFocus. This is needed when playing windowed and enabling ansel (for the people who want to).
110110
if (aobBlocks[WIN_PAUSEONFOCUSLOSS_KEY]->found())

Cameras/Dishonored2/InjectableGenericCameraSystem/System.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ namespace IGCS
359359
Console::WriteLine("Numpad . : Block keyboard/mouse input to game");
360360
Console::WriteLine("ALT+H : This help");
361361
Console::WriteLine("-----------------------------------------------------------------------------", CONSOLE_WHITE);
362+
Console::WriteLine("(c) Otis_Inf. https://patreon.com/Otis_Inf");
363+
Console::WriteLine("-----------------------------------------------------------------------------", CONSOLE_WHITE);
362364
// wait for 350ms to avoid fast keyboard hammering
363365
Sleep(350);
364366
}

Cameras/Dishonored2/InjectableGenericCameraSystem/Utils.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ namespace IGCS::Utils
4343
};
4444

4545
template <typename T>
46-
T clamp(T value, T min, T max, T default)
46+
T clamp(T value, T min, T max, T defaultValue)
4747
{
48-
return value < min ? default
49-
: value > max ? default: value;
48+
return value < min ? defaultValue
49+
: value > max ? defaultValue: value;
5050
}
5151

5252
template <typename T>
53-
T clamp(T value, T min, T default)
53+
T clamp(T value, T min, T defaultValue)
5454
{
55-
return value < min ? default : value;
55+
return value < min ? defaultValue : value;
5656
}
5757

5858

0 commit comments

Comments
 (0)