![]() ![]() |
![]() Post #1 | |
![]() GTA United Lead Developer Posts: 52 From: Germany Joined: 23-April 11 ![]() | Hi, Anybody knows wich memory adresses I have to modify to change the sound of a specific Vehicle ID? I know there is an asi plugin wich does this for me, but I want a solution without that. -------------------- |
![]() ![]() Post #2 | |
![]() Trained Member Posts: 77 Joined: 25-October 10 ![]() | SANNY {$CLEO} // Save as functions/Detect_EXE_version.txt const VERSION_UNKNOWN = -1, VERSION_1_0_US_CRACKED = 1 VERSION_1_0_EURO_CRACKED = 2 VERSION_1_0_EURO_ORIGINAL = 3 VERSION_1_01_EURO_CRACKED = 4 end jump @Detect_EXE_version_end :Get_EXE_version_ID { Description: Returns number of running gta_sa.exe, number depends on gta_sa.exe version. Type: PROPERTY Parameters: Passed: none Result: 0@ - ID of running version, returned values: ; -1 unknown ; 1 - GTA San Andreas v1.0 [US] HOODLUM No-CD Fixed EXE ; 2 - GTA San Andreas v1.0 [EURO] No-CD Fixed EXE ; 3 - GTA San Andreas v1.0 [EURO] Original ; 4 - GTA: San Andreas v1.01 [EURO] No-CD/Fixed EXE Example: 0AB1: call_scm_func @Get_EXE_version_ID 0 get_version_number_to 3@ } 0A8D: 0@ = read_memory 0x400088 size 1 virtual_protect 1 0871: init_jump_table 0@ total_jumps 4 default_jump 0 @Get_EXE_version_ID_unknown jumps 0x8A @Get_EXE_version_ID_GTA_San_Andreas_v1_0_EURO_No_CD_Fixed_EXE 0xCA @Get_EXE_version_ID_GTA_San_Andreas_v1_0_US_HOODLUM_No_CD_Fixed_EXE 0xD0 @Get_EXE_version_ID_GTA_San_Andreas_v1_01_EURO_No_CD_Fixed_EXE 0xF9 @Get_EXE_version_ID_GTA_San_Andreas_v1_0_EURO_Original -1 @Get_EXE_version_ID_unknown -1 @Get_EXE_version_ID_unknown -1 @Get_EXE_version_ID_unknown :Get_EXE_version_ID_GTA_San_Andreas_v1_0_US_HOODLUM_No_CD_Fixed_EXE 0AB2: ret 1 VERSION_1_0_US_CRACKED :Get_EXE_version_ID_GTA_San_Andreas_v1_0_EURO_No_CD_Fixed_EXE 0AB2: ret 1 VERSION_1_0_EURO_CRACKED :Get_EXE_version_ID_GTA_San_Andreas_v1_0_EURO_Original 0AB2: ret 1 VERSION_1_0_EURO_ORIGINAL :Get_EXE_version_ID_GTA_San_Andreas_v1_01_EURO_No_CD_Fixed_EXE 0AB2: ret 1 VERSION_1_01_EURO_CRACKED :Get_EXE_version_ID_unknown 0AB2: ret 1 VERSION_UNKNOWN :Is_EXE_version_equal { Description: Compares ID of running gta_sa.exe with passed ID and checks if game version is equal. Type: CHECK Parameters: Passed: 0@ - ID of running version, returned values: ; -1 unknown ; 1 - GTA San Andreas v1.0 [US] HOODLUM No-CD Fixed EXE ; 2 - GTA San Andreas v1.0 [EURO] No-CD Fixed EXE ; 3 - GTA San Andreas v1.0 [EURO] Original ; 4 - GTA: San Andreas v1.01 [EURO] No-CD/Fixed EXE Result: none Example: if 0AB1: call_scm_func @Is_EXE_version_equal 1 is_exe_version_id_like_this 1 // GTA San Andreas v1.0 [US] HOOLDRUM No-CD Fixed EXE } 0AB1: call_scm_func @Get_EXE_version_ID 0 get_version_number_to 1@ if 003B: 0@ == 1@ // (int) then return_true else return_false end 0AB2: ret 0 :Detect_EXE_version_end :start wait 0 if Actor.Driving($PLAYER_ACTOR) else_jump @start 0811: 0@ = actor $PLAYER_ACTOR car_nosave 0441: 0@ = car 0@ model 0AB1: call_scm_func @GetAddressOfSpecifiedVehicleAudioProperties 1 vehicleID 0@ store_struct_address 0@ 0AD1: show_formatted_text_highpriority "Address: %X" time 2000 0@ jump @start :GetAddressOfSpecifiedVehicleAudioProperties { Description: Gets address of audio properties (struct of 0x24 bytes) by vehicle ID. Type: PROPERTY Parameters: Passed: 0@ - vehicle ID Result: 0@ - struct: audio properties of the vehicle Example: 0AB1: call_scm_func @GetAddressOfSpecifiedVehicleAudioProperties 1 vehicleID 400 store_struct_address 0@ } { #pragma pack(push, 1) struct VehicleAudioPropertiesStruct { __int16 VehicleType; // 1: + 0 __int16 EngineOnSound; // 2: + 2 __int16 EngineOffSound; // 3: + 4 __int16 field_4; // 4: + 6 float field_5; // 5: + 8 float field_6; // 6: + 12 char HornTon; // 7: + 16 char field_8[3]; // 8: + 17, zeros float HornHigh; // 9: + 20 char DoorSound; // 10: + 24 char field_11[1]; // 11: + 25, zeros char RadioNum; // 12: + 26 char RadioType; // 13: + 27 char field_14; // 14: + 28 char field_15[3]; // 15: + 29, zeros float field_16; // 16: + 32 } // ; // #pragma pack(pop) 0AB1: call_scm_func @Get_EXE_version_ID 0 get_version_number_to 1@ 0AB1: call_scm_func @ArrayGetValueByIndex num_params 7 index 1@ total_values 2 default_value 0 VehicleAudioProperties_configure_vehicle_sub400 index1 VERSION_1_0_US_CRACKED value1 0x004F77BB index2 VERSION_1_01_EURO_CRACKED value 0x004F7C1B store_value_to 2@ 0A8D: 3@ = read_memory 2@ size 1 virtual_protect true if 3@ <> 0x90 // nop then 2@ += 1 0A8D: 3@ = read_memory 2@ size 4 virtual_protect true 0062: 0@ -= 3@ // (int) end 0AB1: call_scm_func @ArrayGetValueByIndex num_params 7 index 1@ total_values 2 default_value 0 VehicleAudioProperties_configure_vehicle_memcpy_address index1 VERSION_1_0_US_CRACKED value1 0x004F77CD index2 VERSION_1_01_EURO_CRACKED value 0x004F7C2D store_value_to 4@ 0A8D: 4@ = read_memory 4@ size 4 virtual_protect true 0@ *= 0x24 // 36 bytes 005A: 0@ += 4@ // (int) 0AB2: ret 1 vehicleAudioPropertiesStruct 0@ // Save and include as functions/ArrayGetValueByIndex.txt :ArrayGetValueByIndex { Description: Returns defined already value according to number of key Type: GET Parameters: Passed: 0@ - index to find 1@ - number of input key with values 2@ - default value, returned if index hasn`t been found Repeating: 3@ - index1 4@ - value1 5@ - index2 6@ - value2 As many indexes and values as 1@ number Result: 31@ - value for searched index / default value if index hasn`t been found Formula to get num_params: 3 + total_values * 2 Example: 0AB1: call_scm_func @ArrayGetValueByIndex num_params 7 index 0@ total_values 2 default_value 0 index1 1 value1 0x005387D0 index2 4 value 0x00538C70 store_value_to 3@ } 1@ *= 2 for 31@ = 1 to 1@ step 2 if 003B: 2@(31@,1i) == 0@ // (int) then return_true 0AB2: ret 1 3@(31@,1i) end end return_false 0AB2: ret 1 2@ It is 1.0 and 1.01 compatible, also compatible when my Vehicle Audio Loader is installed/not installed. You should copy and save beginning as functions/Detect_EXE_version.txt, then put {$INCLUDE functions/Detect_EXE_version.txt} Do the same with functions/ArrayGetValueByIndex.txt at the end of file. I included structure of audio properties for single vehicle as comment. This post has been edited by fastman92: Nov 5 2011, 12:05 PM |
![]() ![]() |