Skip to content

Commit d215d15

Browse files
committed
Support for 1.55
1 parent 8e45ca0 commit d215d15

File tree

8 files changed

+132
-99
lines changed

8 files changed

+132
-99
lines changed

dist/ts-fmod-plugin.dll

0 Bytes
Binary file not shown.

ts-fmod-plugin/common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#pragma once
1+
#pragma once
22

33
namespace common
44
{
5-
inline const char* plugin_version = "1.54";
6-
constexpr uint32_t supported_game_version = 54;
5+
inline const char* plugin_version = "1.55";
6+
constexpr uint32_t supported_game_version = 55;
77

88
inline FMOD_GUID get_guid(const std::string& s_guid)
99
{

ts-fmod-plugin/dllmain.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ telemetry_data_t telemetry_data;
1313
scs_log_t scs_log;
1414

1515
uintptr_t base_ctrl_ptr = NULL;
16-
uintptr_t unk_interior_ptr = NULL;
16+
uintptr_t sound_system_ptr = NULL;
1717
uint32_t game_actor_offset = 0;
1818
uintptr_t game_base = NULL;
19-
navigation_voice_event* last_played = nullptr;
19+
voice_navigation_sound_t* last_played = nullptr;
2020
DWORD image_size = 0;
2121

2222
uint32_t stored_engine_state = 0;
@@ -175,7 +175,7 @@ SCSAPI_VOID telemetry_tick(const scs_event_t event, const void* const event_info
175175
}
176176
}
177177

178-
const auto* interior = *reinterpret_cast<sound_library_t**>(unk_interior_ptr);
178+
const auto* interior = *reinterpret_cast<sound_library_t**>(sound_system_ptr);
179179

180180
if (interior != nullptr)
181181
{
@@ -361,25 +361,25 @@ SCSAPI_RESULT scs_telemetry_init(const scs_u32_t version, const scs_telemetry_in
361361
"] Searching for memory offsets... If this is one of the last messages in the log after a crash, try disabling this plugin.";
362362
scs_log(SCS_LOG_TYPE_message, ss.str().c_str());
363363

364-
const auto base_ctrl_ptr_offset = pattern::scan("48 8b 05 ? ? ? ? 48 8b 4b ? 48 8b 80 ? ? ? ? 48 8b b9", game_base, image_size);
364+
const auto base_ctrl_ptr_offset = pattern::scan("48 8b 05 ? ? ? ? 48 8b ? 48 8b 49 ? 48 8b 80", game_base, image_size);
365365
if (base_ctrl_ptr_offset == NULL)
366366
{
367367
version_params->common.log(SCS_LOG_TYPE_error, "[ts-fmod-plugin] Unable to find base_ctrl pointer offset");
368368
return SCS_RESULT_generic_error;
369369
}
370370
base_ctrl_ptr = base_ctrl_ptr_offset + *reinterpret_cast<uint32_t*>(base_ctrl_ptr_offset + 3) + 7;
371-
game_actor_offset = *reinterpret_cast<uint32_t*>(base_ctrl_ptr_offset + 0x0E);
371+
game_actor_offset = *reinterpret_cast<uint32_t*>(base_ctrl_ptr_offset + 0x11);
372372

373-
const auto unk_interior_ptr_offset = pattern::scan("44 38 3b 0f 84 ? ? ? ? 8b 05 ? ? ? ? 48 8b 3d ? ? ? ? 85 c0 74", game_base, image_size);
374-
if (unk_interior_ptr_offset == NULL)
373+
const auto sound_system_ptr_offset = pattern::scan("44 38 3b 0f 84 ? ? ? ? 8b 05 ? ? ? ? 48 8b 3d ? ? ? ? 85 c0 74", game_base, image_size);
374+
if (sound_system_ptr_offset == NULL)
375375
{
376-
version_params->common.log(SCS_LOG_TYPE_error, "[ts-fmod-plugin] Unable to find unk_interior pointer offset");
376+
version_params->common.log(SCS_LOG_TYPE_error, "[ts-fmod-plugin] Unable to find sound_system pointer offset");
377377
return SCS_RESULT_generic_error;
378378
}
379-
unk_interior_ptr = unk_interior_ptr_offset + *reinterpret_cast<uint32_t*>(unk_interior_ptr_offset + 0x12) + 0x16;
379+
sound_system_ptr = sound_system_ptr_offset + *reinterpret_cast<uint32_t*>(sound_system_ptr_offset + 0x12) + 0x16;
380380

381381
ss.str("");
382-
ss << "[ts-fmod-plugin] Found base_ctrl @ " << std::hex << (base_ctrl_ptr - game_base) << " and unk_interior @" << (unk_interior_ptr - game_base);
382+
ss << "[ts-fmod-plugin] Found base_ctrl @ " << std::hex << (base_ctrl_ptr - game_base) << " and sound_system @ " << (sound_system_ptr - game_base);
383383
scs_log(SCS_LOG_TYPE_message, ss.str().c_str());
384384

385385
const auto events_registered =

ts-fmod-plugin/memory_structure.h

Lines changed: 85 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "prism/collections/array_dyn.h"
44
#include "prism/collections/list_dyn.h"
5+
#include "prism/collections/array_local.h"
56
#include "prism/string.h"
67

78
using namespace ts_fmod_plugin::prism;
@@ -194,99 +195,105 @@ class game_actor_u : public unit_t // Size: 0x21E8
194195
};
195196
static_assert( sizeof( game_actor_u ) == 0x21E8 );
196197

197-
class sound_t
198+
// Size: 0x0010
199+
class sound_event_t
198200
{
199-
class sound_player* sound_instance; // 0x0000 (0x08)
200-
char pad_0008[0x28]; // 0x0008 (0x28)
201-
uint32_t is_playing; // 0x0030 (0x04) 1:playing, 4:stop? maybe?
202-
uint32_t something; // 0x0034 (0x04)
203-
class gl* glsl; // 0x0038 (0x08)
204-
char pad_003c[0x18]; // 0x0040 (0x18)
205-
class gl* glsl2; // 0x0058 (0x08)
206-
char* sound_event_name_with_filename; // 0x0060 (0x08)
207-
char pad_0068[0x50]; // 0x0068 (0x50)
208-
209201
public:
210-
uint32_t get_is_playing() const
211-
{
212-
return is_playing;
213-
}
202+
class fmod_event_t* fmod_sound_event; // 0x0008 (0x08)
214203

215-
const char* get_sound_event_name_with_file_name() const
216-
{
217-
return sound_event_name_with_filename;
218-
}
204+
virtual void destructor();
219205
};
206+
static_assert(sizeof(sound_event_t) == 0x10);
220207

221-
class navigation_voice_event
208+
class voice_navigation_sound_t
222209
{
223-
uint32_t pad_0000; // 0x0000 (0x04)
224-
uint32_t pad_0004; // 0x0004 (0x04)
225-
char* event_name; // 0x0008 (0x08)
226-
uint32_t pad_0010; // 0x0010 (0x04)
227-
uint32_t pad_0014; // 0x0014 (0x04)
228-
class navigation* navi_instance; // 0x0018 (0x08)
229-
sound_t* sound_instance; // 0x0020 (0x08)
210+
uint32_t pad_0000; // 0x0000 (0x04)
211+
uint32_t pad_0004; // 0x0004 (0x04)
212+
char* event_name; // 0x0008 (0x08)
213+
uint32_t pad_0010; // 0x0010 (0x04)
214+
uint32_t pad_0014; // 0x0014 (0x04)
215+
sound_event_t event; // 0x0018 (0x10)
230216

231217
public:
232-
sound_t* get_sound_instance() const
233-
{
234-
return sound_instance;
235-
}
236218

237219
const char* get_event_name() const
238220
{
239221
return event_name;
240222
}
241223
};
242224

243-
class sound_library_t // Size: 0x1F58
225+
namespace sound
226+
{
227+
// Size: 0x0008
228+
class sound_owner_t
229+
{
230+
public:
231+
virtual void destructor();
232+
};
233+
static_assert( sizeof( sound_owner_t ) == 0x8 );
234+
235+
// Size: 0x0008
236+
class sound_base_t : public /* [0x08] @ 0x00 */ sound_owner_t
237+
{
238+
public:
239+
};
240+
static_assert( sizeof( sound_base_t ) == 0x8 );
241+
242+
// Size: 0x0010
243+
class sound_stream_t : public /* [0x08] @ 0x00 */ sound_base_t
244+
{
245+
public:
246+
class fmod_stream_t* stream; // 0x0008 (0x08)
247+
};
248+
static_assert( sizeof( sound_stream_t ) == 0x10 );
249+
}
250+
251+
// Size: 0x1F60
252+
class sound_library_t
244253
{
245254
public:
246255
char pad_0008[ 8 ]; // 0x0008 (0x08)
247-
class array_dyn_t< class sound_event_t* > ui_sound_events; // 0x0010 (0x20) local 27
248-
char pad_0030[ 228 ]; // 0x0030 (0xe4)
249-
uint32_t state; // 0x0114 (0x04) 1 = on; 2 = off
250-
bool interior_camera; // 0x0118 (0x01) 1 when camera is set to interior even when head out the window
251-
bool is_camera_inside; // 0x0119 (0x01) 1 if camera is inside, 0 when head through window
252-
char pad_011A[ 2 ]; // 0x011A (0x02)
253-
float camera_rotation_in_cabin; // 0x011C (0x04) 0 = head straight, left is -, right is +, maybe different for UK??
254-
float cabin_out; // 0x0120 (0x04)
255-
char pad_0124[ 4 ]; // 0x0124 (0x04)
256-
class fmod_parameter_t* cabin_type_param; // 0x0128 (0x08)
257-
class fmod_parameter_t* cabin_rot_param; // 0x0130 (0x08)
258-
class fmod_parameter_t* cabin_out_param; // 0x0138 (0x08)
259-
vec2s_t window_state; // 0x0140 (0x08) 0 = closed, 1 = open
260-
class fmod_parameter_t* wnd_left_param; // 0x0148 (0x08)
261-
class fmod_parameter_t* wnd_right_param; // 0x0150 (0x08)
262-
float daytime; // 0x0158 (0x04)
263-
char pad_015C[ 4 ]; // 0x015C (0x04)
264-
class fmod_parameter_t* daytime_param; // 0x0160 (0x08)
265-
char pad_0168[ 48 ]; // 0x0168 (0x30)
266-
class array_dyn_t< class voice_navigation_sound_t > navigation_sounds; // 0x0198 (0x20) local 38
267-
char pad_01B8[ 1520 ]; // 0x01B8 (0x5f0)
268-
class string_dyn_t current_navigation_bank_path; // 0x07A8 (0x18)
269-
navigation_voice_event* now_playing_navigation_sound; // 0x07C0 (0x08)
270-
class list_dyn_t< class voice_navigation_sound_t* > N0000433C; // 0x07C8 (0x38)
271-
class array_dyn_t< class allocator_node_t* > N00004654; // 0x0800 (0x20)
272-
class array_dyn_t< class voice_navigation_sound_t* > navigation_sound_events; // 0x0820 (0x20)
273-
char pad_0840[ 5144 ]; // 0x0840 (0x1418)
274-
bool should_have_echo; // 0x1C58 (0x01)
275-
char pad_1C59[ 223 ]; // 0x1C59 (0xdf)
276-
class array_dyn_t< class sound_event_t* > N000045E9; // 0x1D38 (0x20) local 20
277-
char pad_1D58[ 168 ]; // 0x1D58 (0xa8)
278-
class array_dyn_t< class sound_stream_t > N00004602; // 0x1E00 (0x20) local 1
279-
char pad_1E20[ 16 ]; // 0x1E20 (0x10)
280-
class array_dyn_t<bool> N00004605; // 0x1E30 (0x20) local 1
281-
char pad_1E50[ 56 ]; // 0x1E50 (0x38)
282-
class array_dyn_t< class cbradio_beep_item_t* > N00004610; // 0x1E88 (0x20)
283-
token_t gps_voice; // 0x1EA8 (0x08)
284-
char pad_1EB0[ 8 ]; // 0x1EB0 (0x08)
285-
class array_dyn_t< string_dyn_t > ambient_sounds; // 0x1EB8 (0x20) local 3
286-
char pad_1ED8[ 72 ]; // 0x1ED8 (0x48)
287-
class string_dyn_t current_reverb; // 0x1F20 (0x18)
288-
class string_dyn_t N00004627; // 0x1F38 (0x18)
289-
char pad_1F50[ 8 ]; // 0x1F50 (0x08)
256+
array_local_t< class sound_event_t*, 28ul > ui_sound_events; // 0x0010 (0x100)
257+
char pad_0110[ 12 ]; // 0x0110 (0x0c)
258+
uint32_t state; // 0x011C (0x04) 1 = on; 2 = off
259+
bool interior_camera; // 0x0120 (0x01)
260+
bool is_camera_inside; // 0x0121 (0x01)
261+
char pad_0122[ 2 ]; // 0x0122 (0x02)
262+
float camera_rotation_in_cabin; // 0x0124 (0x04)
263+
float cabin_out; // 0x0128 (0x04)
264+
char pad_012C[ 4 ]; // 0x012C (0x04)
265+
class fmod_parameter_t* cabin_type_param; // 0x0130 (0x08)
266+
class fmod_parameter_t* cabin_rot_param; // 0x0138 (0x08)
267+
class fmod_parameter_t* cabin_out_param; // 0x0140 (0x08)
268+
vec2s_t window_state; // 0x0148 (0x08)
269+
class fmod_parameter_t* wnd_left_param; // 0x0150 (0x08)
270+
class fmod_parameter_t* wnd_right_param; // 0x0158 (0x08)
271+
float daytime; // 0x0160 (0x04)
272+
char pad_0164[ 4 ]; // 0x0164 (0x04)
273+
class fmod_parameter_t* daytime_param; // 0x0168 (0x08)
274+
char pad_0170[ 48 ]; // 0x0170 (0x30)
275+
array_local_t< voice_navigation_sound_t, 38ul > navigation_sounds; // 0x01A0 (0x610)
276+
string_dyn_t current_navigation_bank_path; // 0x07B0 (0x18)
277+
voice_navigation_sound_t* now_playing_navigation_sound; // 0x07C8 (0x08)
278+
list_dyn_t< class voice_navigation_sound_t* > N0000433C; // 0x07D0 (0x58)
279+
array_dyn_t< class voice_navigation_sound_t* > navigation_sound_events; // 0x0828 (0x20)
280+
char pad_0848[ 5144 ]; // 0x0848 (0x1418)
281+
bool should_have_echo; // 0x1C60 (0x01)
282+
char pad_1C61[ 223 ]; // 0x1C61 (0xdf)
283+
array_local_t< class sound_event_t*, 20ul > N0000D549; // 0x1D40 (0xc0)
284+
char pad_1E00[ 8 ]; // 0x1E00 (0x08)
285+
array_local_t< sound::sound_stream_t, 1ul > N0000D565; // 0x1E08 (0x30)
286+
array_local_t< bool, 1ul > N0001ADE2; // 0x1E38 (0x21)
287+
char pad_1E59[ 7 ]; // 0x1E59 (0x07)
288+
sound_event_t cb_radio_start; // 0x1E60 (0x10)
289+
sound_event_t cb_radio_stop; // 0x1E70 (0x10)
290+
sound_event_t cb_radio_noise; // 0x1E80 (0x10)
291+
array_dyn_t< class cbradio_beep_item_t* > N0000D574; // 0x1E90 (0x20)
292+
char pad_1EB0[ 16 ]; // 0x1EB0 (0x10)
293+
array_local_t< string_dyn_t, 3ul > ambient_sounds; // 0x1EC0 (0x68)
294+
string_dyn_t current_reverb; // 0x1F28 (0x18)
295+
string_dyn_t current_ambient_sfx; // 0x1F40 (0x18)
296+
char pad_1F58[ 8 ]; // 0x1F58 (0x08)
290297

291298
virtual void destructor();
292299

@@ -321,10 +328,11 @@ class sound_library_t // Size: 0x1F58
321328
return cabin_out;
322329
}
323330

324-
navigation_voice_event* get_now_playing_navigation_sound() const
331+
voice_navigation_sound_t* get_now_playing_navigation_sound() const
325332
{
326333
return now_playing_navigation_sound;
327334
}
328335
};
329-
static_assert(sizeof(sound_library_t) == 0x1F58);
336+
static_assert( sizeof( sound_library_t ) == 0x1F60 );
337+
330338
#pragma pack( pop )
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
#include "./array.h"
3+
#include <cstdint>
4+
5+
#pragma pack( push, 1 )
6+
namespace ts_fmod_plugin::prism
7+
{
8+
template < class T, uint64_t S >
9+
class array_local_t : public array_t< T >
10+
{
11+
public:
12+
uint64_t capacity;
13+
14+
private:
15+
T _items[ S ];
16+
};
17+
18+
static_assert( sizeof( array_local_t< void*, 5 > ) == 0x48, "array_local_t is incorrect in size" );
19+
}
20+
#pragma pack( pop )

ts-fmod-plugin/prism/collections/list_dyn.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ namespace ts_fmod_plugin::prism
1717
template < class T > class list_dyn_t // Size: 0x0038
1818
{
1919
public:
20-
uint64_t size; // 0x0008 (0x08)
21-
list_dyn_node_t< T >* begin; // 0x0010 (0x08)
22-
list_dyn_node_t< T >* end; // 0x0018 (0x08)
23-
T* empty_item; // 0x0020 (0x08)
24-
uint64_t capacity; // 0x0028 (0x08)
25-
char pad_0030[ 8 ]; // 0x0030 (0x08)
20+
uint64_t size; // 0x0008 (0x08)
21+
list_dyn_node_t< T >* begin; // 0x0010 (0x08)
22+
list_dyn_node_t< T >* end; // 0x0018 (0x08)
23+
T* empty_item; // 0x0020 (0x08)
24+
uint64_t capacity; // 0x0028 (0x08)
25+
char pad_0030[ 8 ]; // 0x0030 (0x08)
26+
array_dyn_t< class allocator_node_t* > allocator_nodes; // 0x0038 (0x20)
2627

2728
virtual void destructor();
2829
};
29-
static_assert( sizeof( list_dyn_t< void* > ) == 0x38 );
30+
static_assert( sizeof( list_dyn_t< void* > ) == 0x58 );
3031
}
3132
#pragma pack( pop )

ts-fmod-plugin/ts-fmod-plugin.vcxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
<ClInclude Include="pch.h" />
181181
<ClInclude Include="prism\collections\array.h" />
182182
<ClInclude Include="prism\collections\array_dyn.h" />
183+
<ClInclude Include="prism\collections\array_local.h" />
183184
<ClInclude Include="prism\collections\list_dyn.h" />
184185
<ClInclude Include="prism\string.h" />
185186
<ClInclude Include="resource.h" />
@@ -204,4 +205,4 @@
204205
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
205206
<ImportGroup Label="ExtensionTargets">
206207
</ImportGroup>
207-
</Project>
208+
</Project>

ts-fmod-plugin/ts-fmod-plugin.vcxproj.filters

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
<ClInclude Include="prism\string.h">
5757
<Filter>Header Files</Filter>
5858
</ClInclude>
59+
<ClInclude Include="prism\collections\array_local.h">
60+
<Filter>Header Files</Filter>
61+
</ClInclude>
5962
</ItemGroup>
6063
<ItemGroup>
6164
<ClCompile Include="dllmain.cpp">
@@ -77,4 +80,4 @@
7780
<ItemGroup>
7881
<ResourceCompile Include="ts-fmod-plugin.rc" />
7982
</ItemGroup>
80-
</Project>
83+
</Project>

0 commit comments

Comments
 (0)