Skip to content

Commit 0b68660

Browse files
committed
TR 2013 fix for patch 2021116
1 parent 52f09d4 commit 0b68660

File tree

3 files changed

+25
-29
lines changed

3 files changed

+25
-29
lines changed

Cameras/Tombraider/InjectableGenericCameraSystem/CameraManipulator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void SetTimeStopValue(byte newValue)
4545
// set flag so camera works during menu driven timestop
4646
_timeHasBeenStopped = (newValue == 1);
4747
float* gamespeedAddress = reinterpret_cast<float*>(_gamespeedStructAddress + GAMESPEED_IN_STRUCT_OFFSET);
48-
*gamespeedAddress = _timeHasBeenStopped ? 0.00001f : 1.0f;
48+
*gamespeedAddress = _timeHasBeenStopped ? 0.000001f : 1.0f;
4949
}
5050

5151

Cameras/Tombraider/InjectableGenericCameraSystem/GameConstants.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
// Mandatory constants to define for a game
3131
#define GAME_NAME "Tomb Raider v1.1.748"
32-
#define CAMERA_VERSION "1.0.2"
32+
#define CAMERA_VERSION "1.0.3"
3333
#define CAMERA_CREDITS "Otis_Inf. Thanks to Jim2Point0"
3434
#define GAME_WINDOW_TITLE "Tomb Raider"
3535
#define INITIAL_PITCH_RADIANS 0.0f
@@ -39,21 +39,21 @@
3939
// End Mandatory constants
4040

4141
// Offsets for camera intercept code. Used in interceptor.
42-
#define CAMERA_ADDRESS_INTERCEPT_START_OFFSET 0x5D43D2
43-
#define CAMERA_ADDRESS_INTERCEPT_CONTINUE_OFFSET 0x5D43D8
42+
#define CAMERA_ADDRESS_INTERCEPT_START_OFFSET 0x61DD8D
43+
#define CAMERA_ADDRESS_INTERCEPT_CONTINUE_OFFSET 0x61DD98
4444

45-
#define CAMERA_WRITE_INTERCEPT1_START_OFFSET 0x8BCC9
46-
#define CAMERA_WRITE_INTERCEPT1_CONTINUE_OFFSET 0x8BCD0
47-
#define CAMERA_WRITE_INTERCEPT2_START_OFFSET 0x5D4439
48-
#define CAMERA_WRITE_INTERCEPT2_CONTINUE_OFFSET 0x5D444E
45+
#define CAMERA_WRITE_INTERCEPT1_START_OFFSET 0xF4D29
46+
#define CAMERA_WRITE_INTERCEPT1_CONTINUE_OFFSET 0xF4D30
47+
#define CAMERA_WRITE_INTERCEPT2_START_OFFSET 0x61DDA3
48+
#define CAMERA_WRITE_INTERCEPT2_CONTINUE_OFFSET 0x61DDAE
4949

50-
#define GAMESPEED_ADDRESS_INTERCEPT_START_OFFSET 0x2E6254
51-
#define GAMESPEED_ADDRESS_INTERCEPT_CONTINUE_OFFSET 0x2E625A
50+
#define GAMESPEED_ADDRESS_INTERCEPT_START_OFFSET 0x33D782
51+
#define GAMESPEED_ADDRESS_INTERCEPT_CONTINUE_OFFSET 0x33D788
5252

53-
#define FOV_WRITE_INTERCEPT1_START_OFFSET 0x5D4461
54-
#define FOV_WRITE_INTERCEPT1_CONTINUE_OFFSET 0x5D4467
55-
#define FOV_WRITE_INTERCEPT2_START_OFFSET 0x5CFF9A
56-
#define FOV_WRITE_INTERCEPT2_CONTINUE_OFFSET 0x5CFFA2
53+
#define FOV_WRITE_INTERCEPT1_START_OFFSET 0x61DDB3
54+
#define FOV_WRITE_INTERCEPT1_CONTINUE_OFFSET 0x61DDB9
55+
#define FOV_WRITE_INTERCEPT2_START_OFFSET 0x61A10C
56+
#define FOV_WRITE_INTERCEPT2_CONTINUE_OFFSET 0x61A111
5757

5858
// Indices in the structures read by interceptors
5959
#define LOOK_QUATERNION_IN_CAMERA_STRUCT_OFFSET 0x440

Cameras/Tombraider/InjectableGenericCameraSystem/Interceptor.asm

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,34 +61,33 @@ cameraAddressInterceptor PROC
6161
; Game jmps to this location due to the hook set in C function SetCameraStructInterceptorHook
6262
mov [_cameraStructAddress], esi ; intercept address of camera struct
6363
exit:
64-
mov [esi-60h],eax ; original statement
65-
mov ecx,[edi+04h]
64+
movups xmm0, xmmword ptr [esi+000003C0h]
65+
movups xmmword ptr [esi-50h],xmm0
6666
jmp [_cameraStructInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above.
6767
cameraAddressInterceptor ENDP
6868

6969

7070
gamespeedAddressInterceptor PROC
71-
mov [_gamespeedStructAddress], esi
71+
mov [_gamespeedStructAddress], edi
7272
cmp byte ptr [_timeStopped], 1
7373
je exit
7474
originalCode:
75-
fstp dword ptr [esi+00000104h]
75+
fstp dword ptr [edi+00000104h]
7676
exit:
7777
jmp [_gamespeedInterceptionContinue]
7878
gamespeedAddressInterceptor ENDP
7979

8080

8181
fovWriteInterceptor1 PROC
8282
; Game jmps to this location due to the hook set in C function SetFoVWriteInterceptorHooks.
83+
mov ecx,[ebp-04h]
8384
cmp dword ptr esi, [_cameraStructAddress]
8485
jne originalCode
8586
cmp byte ptr [_cameraEnabled], 1 ; check if the user enabled the camera. If so, just skip the write statements, otherwise just execute the original code.
8687
je exit ; our own camera is enabled, just skip the writes
8788
originalCode:
88-
fstp dword ptr [esi-78h] ; original statement
89+
fstp dword ptr [esi-78h]
8990
exit:
90-
push ebx ; original statement
91-
mov ecx,edi ; original statement
9291
jmp [_fovWriteInterceptionContinue1] ; jmp back into the original game code which is the location after the original statements above.
9392
fovWriteInterceptor1 ENDP
9493

@@ -99,8 +98,8 @@ fovWriteInterceptor2 PROC
9998
je exit ; our own camera is enabled, just skip the writes
10099
originalCode:
101100
fld dword ptr [eax+ecx+38h] ; original statement
102-
lea eax,[eax+ecx+10h] ; original statement
103101
exit:
102+
pop ebp
104103
jmp [_fovWriteInterceptionContinue2] ; jmp back into the original game code which is the location after the original statements above.
105104
fovWriteInterceptor2 ENDP
106105

@@ -112,12 +111,12 @@ fovWriteInterceptor2 ENDP
112111

113112
cameraWriteInterceptor1 PROC
114113
; Game jmps to this location due to the hook set in C function SetCameraWriteInterceptorHooks.
115-
cmp dword ptr esi, [_cameraStructAddressInterceptor1]
114+
cmp dword ptr ecx, [_cameraStructAddressInterceptor1]
116115
jne originalCode
117116
cmp byte ptr [_cameraEnabled], 1 ; check if the user enabled the camera. If so, just skip the write statements, otherwise just execute the original code.
118117
je exit ; our own camera is enabled, just skip the writes
119118
originalCode:
120-
movaps [esi+090h],xmm0
119+
movaps [ecx+00000090h],xmm0
121120
exit:
122121
jmp [_cameraWriteInterceptionContinue1] ; jmp back into the original game code which is the location after the original statements above.
123122
cameraWriteInterceptor1 ENDP
@@ -130,11 +129,8 @@ cameraWriteInterceptor2 PROC
130129
cmp byte ptr [_cameraEnabled], 1 ; check if the user enabled the camera. If so, just skip the write statements, otherwise just execute the original code.
131130
je exit ; our own camera is enabled, just skip the writes
132131
originalCode:
133-
mov [esi-30h],eax
134-
mov ecx,[esi+000003E4h]
135-
mov [esi-2Ch],ecx
136-
mov edx,[esi+000003E8h]
137-
mov [esi-28h],edx
132+
movups xmm0, xmmword ptr [esi+000003E0h]
133+
movups xmmword ptr [esi-30h],xmm0
138134
exit:
139135
jmp [_cameraWriteInterceptionContinue2] ; jmp back into the original game code which is the location after the original statements above.
140136
cameraWriteInterceptor2 ENDP

0 commit comments

Comments
 (0)