III: Corrected FBI Car secondary siren sound

This commit is contained in:
Silent 2019-12-08 19:33:04 +01:00
parent a72b52868c
commit de60ad587c
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1

View File

@ -485,7 +485,19 @@ namespace AudioInitializedFix
orgLoadAllAudioScriptObjects( buffer, a2 );
}
}
}
};
// ============= Corrected FBI Car secondary siren sound =============
namespace SirenSwitchingFix
{
static bool (__thiscall *orgUsesSirenSwitching)(void* pThis, unsigned int index);
static bool __fastcall UsesSirenSwitching_FbiCar( void* pThis, void*, unsigned int index )
{
// index 17 = FBICAR
return index == 17 || orgUsesSirenSwitching( pThis, index );
}
};
void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModulePath )
{
@ -514,6 +526,21 @@ void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModul
Patch<int8_t>( canPickBlista.get_first<void>( 2 ), 127 ); // coach
}
}
// Corrected FBI Car secondary siren sound
{
using namespace SirenSwitchingFix;
// Other mods might be touching it, so only patch specific vehicles if their code has not been touched at all
auto usesSirenSwitching = pattern( "E8 ? ? ? ? 84 C0 74 12 83 C4 08" ).count_hint(1);
if ( usesSirenSwitching.size() == 1 )
{
auto match = usesSirenSwitching.get_one();
ReadCall( match.get<void>(), orgUsesSirenSwitching );
InjectHook( match.get<void>(), UsesSirenSwitching_FbiCar );
}
}
}
void InjectDelayedPatches_III_Common()