mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-27 03:24:15 +01:00
cAudioManager::Initialise
This commit is contained in:
parent
9062f958a4
commit
d6944ec570
@ -94,6 +94,102 @@ constexpr int totalAudioEntitiesSlots = 200;
|
||||
|
||||
char &g_nMissionAudioPlayingStatus = *(char *)0x60ED88;
|
||||
|
||||
void
|
||||
cAudioManager::Initialise()
|
||||
{
|
||||
if(!m_bIsInitialised) {
|
||||
PreInitialiseGameSpecificSetup();
|
||||
m_bIsInitialised = cSampleManager.Initialise();
|
||||
if(m_bIsInitialised) {
|
||||
m_bActiveSamples = cSampleManager.GetActiveSamples();
|
||||
if(m_bActiveSamples <= 1u) {
|
||||
Terminate();
|
||||
} else {
|
||||
--m_bActiveSamples;
|
||||
PostInitialiseGameSpecificSetup();
|
||||
InitialisePoliceRadioZones();
|
||||
InitialisePoliceRadio();
|
||||
MusicManager.Initialise();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::PostInitialiseGameSpecificSetup()
|
||||
{
|
||||
m_nFireAudioEntity = CreateEntity(
|
||||
AUDIOTYPE_FIRE, (CPhysical *)0x8F31D0); // last is addr of firemanager @todo change
|
||||
if(m_nFireAudioEntity >= 0) cAudioManager::SetEntityStatus(m_nFireAudioEntity, 1);
|
||||
|
||||
m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (CPhysical *)1);
|
||||
if(m_nCollisionEntity >= 0) cAudioManager::SetEntityStatus(m_nCollisionEntity, 1);
|
||||
|
||||
m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (CPhysical *)1);
|
||||
if(m_nFrontEndEntity >= 0) cAudioManager::SetEntityStatus(m_nFrontEndEntity, 1);
|
||||
|
||||
m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (CPhysical *)1);
|
||||
if(m_nProjectileEntity >= 0) cAudioManager::SetEntityStatus(m_nProjectileEntity, 1);
|
||||
|
||||
m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATER_CANNON, (CPhysical *)1);
|
||||
if(m_nWaterCannonEntity >= 0) cAudioManager::SetEntityStatus(m_nWaterCannonEntity, 1);
|
||||
|
||||
m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_D, (CPhysical *)1);
|
||||
if(m_nPoliceChannelEntity >= 0) cAudioManager::SetEntityStatus(m_nPoliceChannelEntity, 1);
|
||||
|
||||
m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (CPhysical *)1);
|
||||
if(m_nBridgeEntity >= 0) cAudioManager::SetEntityStatus(m_nBridgeEntity, 1);
|
||||
|
||||
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
|
||||
m_sMissionAudio.m_bLoadingStatus = 0;
|
||||
m_sMissionAudio.m_bPlayStatus = 0;
|
||||
m_sMissionAudio.field_22 = 0;
|
||||
m_sMissionAudio.m_bIsPlayed = 0;
|
||||
m_sMissionAudio.field_12 = 1;
|
||||
m_sMissionAudio.field_24 = 0;
|
||||
ResetAudioLogicTimers((int32)CTimer::GetTimeInMilliseconds);
|
||||
}
|
||||
|
||||
WRAPPER
|
||||
void
|
||||
cAudioManager::InitialisePoliceRadioZones()
|
||||
{
|
||||
EAXJMP(0x57EAC0);
|
||||
}
|
||||
|
||||
WRAPPER
|
||||
void
|
||||
cAudioManager::ResetAudioLogicTimers(int32 timer)
|
||||
{
|
||||
EAXJMP(0x569650);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::Terminate()
|
||||
{
|
||||
if(m_bIsInitialised) {
|
||||
MusicManager.Terminate();
|
||||
|
||||
for(uint32 i = 0; i < totalAudioEntitiesSlots; i++) {
|
||||
m_asAudioEntities[i].m_bIsUsed = 0;
|
||||
m_anAudioEntityIndices[i] = 200;
|
||||
}
|
||||
|
||||
m_nAudioEntitiesTotal = 0;
|
||||
m_nScriptObjectEntityTotal = 0;
|
||||
PreTerminateGameSpecificShutdown();
|
||||
|
||||
for(uint32 i = 0; i < 2; i++) {
|
||||
if(cSampleManager.IsSampleBankLoaded(i)) cSampleManager.UnloadSampleBank(i);
|
||||
}
|
||||
|
||||
cSampleManager.Terminate();
|
||||
|
||||
m_bIsInitialised = 0;
|
||||
PostTerminateGameSpecificShutdown();
|
||||
}
|
||||
}
|
||||
|
||||
char
|
||||
cAudioManager::GetMissionScriptPoliceAudioPlayingStatus()
|
||||
{
|
||||
@ -469,17 +565,17 @@ cAudioManager::IsAudioInitialised() const
|
||||
}
|
||||
|
||||
int32
|
||||
cAudioManager::CreateEntity(int32 type, CPhysical *memory)
|
||||
cAudioManager::CreateEntity(int32 type, CPhysical *entity)
|
||||
{
|
||||
if(!m_bIsInitialised) return -4;
|
||||
if(!memory) return -2;
|
||||
if(!entity) return -2;
|
||||
if(type >= TOTAL_AUDIO_TYPES) return -1;
|
||||
for(uint32 i = 0; i < 200; i++) {
|
||||
if(!m_asAudioEntities[i].m_bIsUsed) {
|
||||
m_asAudioEntities[i].m_bIsUsed = true;
|
||||
m_asAudioEntities[i].m_bStatus = 0;
|
||||
m_asAudioEntities[i].m_nType = (eAudioType)type;
|
||||
m_asAudioEntities[i].m_pEntity = memory;
|
||||
m_asAudioEntities[i].m_pEntity = entity;
|
||||
m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_TOTAL_PED_SOUNDS;
|
||||
m_asAudioEntities[i].m_awAudioEvent[1] = SOUND_TOTAL_PED_SOUNDS;
|
||||
m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_TOTAL_PED_SOUNDS;
|
||||
@ -2720,6 +2816,12 @@ cAudioManager::Service()
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x57A0E0, &cAudioManager::Initialise, PATCH_JUMP);
|
||||
InjectHook(0x569420, &cAudioManager::PostInitialiseGameSpecificSetup, PATCH_JUMP);
|
||||
//InjectHook(0x57EAC0, &cAudioManager::InitialisePoliceRadioZones, PATCH_JUMP);
|
||||
//InjectHook(0x569650, &cAudioManager::ResetAudioLogicTimers, PATCH_JUMP);
|
||||
InjectHook(0x57A150, &cAudioManager::Terminate, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x57F050, &cAudioManager::GetMissionScriptPoliceAudioPlayingStatus, PATCH_JUMP);
|
||||
InjectHook(0x5795D0, &cAudioManager::GetMissionAudioLoadingStatus, PATCH_JUMP);
|
||||
|
||||
|
@ -218,6 +218,15 @@ public:
|
||||
char field_19195;
|
||||
int m_nTimeOfRecentCrime;
|
||||
|
||||
void Initialise();
|
||||
void PostInitialiseGameSpecificSetup();
|
||||
void InitialisePoliceRadioZones(); // @todo
|
||||
void ResetAudioLogicTimers(int32 timer); // @todo
|
||||
|
||||
void Terminate();
|
||||
|
||||
// done
|
||||
|
||||
char GetMissionScriptPoliceAudioPlayingStatus();
|
||||
bool GetMissionAudioLoadingStatus();
|
||||
|
||||
@ -282,8 +291,6 @@ public:
|
||||
|
||||
void InitialisePoliceRadio();
|
||||
|
||||
// done
|
||||
|
||||
int32 RandomDisplacement(uint32 seed);
|
||||
|
||||
void ReleaseDigitalHandle();
|
||||
@ -292,7 +299,7 @@ public:
|
||||
|
||||
bool IsAudioInitialised() const;
|
||||
|
||||
int32 CreateEntity(int32 type, CPhysical *memory);
|
||||
int32 CreateEntity(int32 type, CPhysical *entity);
|
||||
void DestroyEntity(int32 id);
|
||||
void SetEntityStatus(int32 id, bool status);
|
||||
|
||||
|
@ -174,3 +174,17 @@ void cMusicManager::DisplayRadioStationName()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
WRAPPER
|
||||
void
|
||||
cMusicManager::Initialise()
|
||||
{
|
||||
EAXJMP(0x57CF70);
|
||||
}
|
||||
|
||||
WRAPPER
|
||||
void
|
||||
cMusicManager::Terminate()
|
||||
{
|
||||
EAXJMP(0x57D140);
|
||||
}
|
||||
|
@ -264,6 +264,9 @@ public:
|
||||
uint8 field_2395;
|
||||
|
||||
public:
|
||||
void Initialise();
|
||||
void Terminate();
|
||||
|
||||
char *Get3DProviderName(char);
|
||||
bool PlayerInCar();
|
||||
void DisplayRadioStationName();
|
||||
|
@ -12,6 +12,33 @@ bool CSampleManager::IsMP3RadioChannelAvailable() {
|
||||
return nNumOfMp3Files != 0;
|
||||
}
|
||||
|
||||
WRAPPER
|
||||
bool CSampleManager::IsSampleBankLoaded(uint8) { EAXJMP(0x567130); }
|
||||
|
||||
WRAPPER
|
||||
void CSampleManager::UnloadSampleBank(uint8) { EAXJMP(0x567110); }
|
||||
|
||||
WRAPPER
|
||||
void
|
||||
CSampleManager::Terminate()
|
||||
{
|
||||
EAXJMP(0x566DC0);
|
||||
}
|
||||
|
||||
WRAPPER
|
||||
bool
|
||||
CSampleManager::Initialise()
|
||||
{
|
||||
EAXJMP(0x566530);
|
||||
}
|
||||
|
||||
WRAPPER
|
||||
int32
|
||||
CSampleManager::GetActiveSamples()
|
||||
{
|
||||
EAXJMP(0x565970);
|
||||
}
|
||||
|
||||
WRAPPER void
|
||||
CSampleManager::ReleaseDigitalHandle()
|
||||
{
|
||||
@ -87,6 +114,7 @@ CSampleManager::StopChannel(int32 id)
|
||||
{
|
||||
EAXJMP(0x567BE0);
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x566490, CSampleManager::IsMP3RadioChannelAvailable, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -11,6 +11,13 @@ struct tSample {
|
||||
class CSampleManager
|
||||
{
|
||||
public:
|
||||
bool IsSampleBankLoaded(uint8);
|
||||
void UnloadSampleBank(uint8);
|
||||
void Terminate();
|
||||
|
||||
bool Initialise();
|
||||
int32 GetActiveSamples();
|
||||
|
||||
void ReleaseDigitalHandle();
|
||||
void RequireDigitalHandle();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user