Merge pull request #108 from ShFil119/audio3

Implement smallest functions from AudioManager
This commit is contained in:
aap 2019-07-05 14:35:06 +02:00 committed by GitHub
commit 4d0e743232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1283 additions and 971 deletions

File diff suppressed because it is too large Load Diff

View File

@ -71,12 +71,14 @@ enum eAudioType : int32 {
TOTAL_AUDIO_TYPES = 14, TOTAL_AUDIO_TYPES = 14,
}; };
class CPhysical;
class tAudioEntity class tAudioEntity
{ {
public: public:
eAudioType m_nType; eAudioType m_nType;
void *m_pEntity; CPhysical *m_pEntity;
char m_bIsUsed; bool m_bIsUsed;
char m_bStatus; char m_bStatus;
int16 m_awAudioEvent[4]; int16 m_awAudioEvent[4];
char gap_18[2]; char gap_18[2];
@ -159,7 +161,7 @@ public:
char field_22; char field_22;
char field_23; char field_23;
int field_24; int field_24;
char m_bIsPlayed; bool m_bIsPlayed;
char field_29; char field_29;
char field_30; char field_30;
char field_31; char field_31;
@ -175,7 +177,7 @@ public:
char field_2; char field_2;
char m_bActiveSamples; char m_bActiveSamples;
char field_4; char field_4;
char m_bDynamicAcousticModelingStatus; bool m_bDynamicAcousticModelingStatus;
char field_6; char field_6;
char field_7; char field_7;
float field_8; float field_8;
@ -185,7 +187,7 @@ public:
char field_15; char field_15;
int m_nTimer; int m_nTimer;
tActiveSample m_sQueueSample; tActiveSample m_sQueueSample;
char m_bActiveSampleQueue; uint8 m_bActiveSampleQueue;
char gap_109[3]; char gap_109[3];
tActiveSample m_asSamples[54]; tActiveSample m_asSamples[54];
char m_abSampleQueueIndexTable[54]; char m_abSampleQueueIndexTable[54];
@ -216,7 +218,92 @@ public:
char field_19195; char field_19195;
int m_nTimeOfRecentCrime; int m_nTimeOfRecentCrime;
void PlayerJustLeftCar(void); char GetMissionScriptPoliceAudioPlayingStatus();
bool GetMissionAudioLoadingStatus();
uint8 GetNum3DProvidersAvailable();
int8 AutoDetect3DProviders();
bool IsMP3RadioChannelAvailable();
uint8 GetCDAudioDriveLetter();
void SetEffectsMasterVolume(uint8 volume);
void SetMusicMasterVolume(uint8 volume);
void SetEffectsFadeVol(uint8 volume);
void SetMusicFadeVol(uint8 volume);
void SetSpeakerConfig(int32 conf);
void ProcessJumboFlying();
bool SetupJumboEngineSound(uint8, int32); // todo
void PreInitialiseGameSpecificSetup();
void SetMissionScriptPoliceAudio(int32 sfx);
void CalculateDistance(bool *ptr, float dist);
bool UsesSiren(int32 model);
bool UsesSirenSwitching(int32 model);
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission);
uint8 Get3DProviderName(uint8 id);
void ProcessJumboTaxi();
bool SetupJumboFlySound(uint8); // todo
bool SetupJumboTaxiSound(uint8); // todo
bool SetupJumboWhineSound(uint8, int32); // todo
void PlayLoadedMissionAudio();
void SetMissionAudioLocation(float x, float y, float z);
void ResetPoliceRadio();
void InterrogateAudioEntities();
void ClearRequestedQueue();
// void AgeCrimes();
bool UsesReverseWarning(int32 model);
bool HasAirBrakes(int32 model);
int32 GetJumboTaxiFreq();
void ProcessPhysical(int32 id);
void ProcessVehicle(CPhysical *); // todo
void ProcessPed(CPhysical *); // todo
void ProcessPlane(void *); // todo
void ClearMissionAudio();
// void ProcessReverb();
bool IsMissionAudioSampleFinished();
void ProcessEntity(int32);
void InitialisePoliceRadio();
// done
int32 RandomDisplacement(uint32 seed);
void ReleaseDigitalHandle();
void RequireDigitalHandle();
void SetDynamicAcousticModelingStatus(bool status);
bool IsAudioInitialised() const;
int32 CreateEntity(int32 type, CPhysical *memory);
void DestroyEntity(int32 id);
void SetEntityStatus(int32 id, bool status);
void PreTerminateGameSpecificShutdown();
void PostTerminateGameSpecificShutdown();
void GenerateIntegerRandomNumberTable();
void PlayerJustGotInCar();
void PlayerJustLeftCar();
void Service(); void Service();
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample,
uint32 maxOffset); uint32 maxOffset);

View File

@ -1,9 +1,92 @@
#include "common.h" #include "common.h"
#include "patcher.h"
#include "SampleManager.h" #include "SampleManager.h"
CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0; CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0;
uint32 &CSampleManager::nNumOfMp3Files = *(uint32*)0x95CC00;
uint32 &nNumOfMp3Files = *(uint32 *)0x95CC00;
uint8 &num3DProvidersAvailable = *(uint8 *)0x734237;
uint32 *asName3DProviders = (uint32 *)0x734238;
bool CSampleManager::IsMP3RadioChannelAvailable() { bool CSampleManager::IsMP3RadioChannelAvailable() {
return nNumOfMp3Files != 0; return nNumOfMp3Files != 0;
} }
WRAPPER void
CSampleManager::ReleaseDigitalHandle()
{
EAXJMP(0x5664B0);
}
WRAPPER
void
CSampleManager::RequireDigitalHandle()
{
EAXJMP(0x5664F0);
}
WRAPPER
char
CSampleManager::AutoDetect3DProviders()
{
EAXJMP(0x565990);
}
WRAPPER
uint8
CSampleManager::GetCDAudioDriveLetter()
{
EAXJMP(0x566F20);
}
WRAPPER
void
CSampleManager::SetEffectsMasterVolume(uint8 volume)
{
EAXJMP(0x567010);
}
WRAPPER
void
CSampleManager::SetMusicMasterVolume(uint8 volume)
{
EAXJMP(0x567020);
}
WRAPPER
void
CSampleManager::SetEffectsFadeVol(uint8 volume)
{
EAXJMP(0x567030);
}
WRAPPER
void
CSampleManager::SetMusicFadeVol(uint8 volume)
{
EAXJMP(0x567040);
}
WRAPPER
void
CSampleManager::SetSpeakerConfig(uint32 config)
{
EAXJMP(0x565900);
}
WRAPPER
bool
CSampleManager::GetChannelUsedFlag(int32 id)
{
EAXJMP(0x567B00);
}
WRAPPER
void
CSampleManager::StopChannel(int32 id)
{
EAXJMP(0x567BE0);
}
STARTPATCHES
InjectHook(0x566490, CSampleManager::IsMP3RadioChannelAvailable, PATCH_JUMP);
ENDPATCHES

View File

@ -1,11 +1,37 @@
#pragma once #pragma once
class CSampleManager { struct tSample {
public: int m_nOffset;
static uint32 &nNumOfMp3Files; unsigned int m_nSize;
int m_nFrequency;
int m_nLoopStart;
int m_nLoopEnd;
};
class CSampleManager
{
public: public:
void ReleaseDigitalHandle();
void RequireDigitalHandle();
char AutoDetect3DProviders();
uint8 GetCDAudioDriveLetter();
void SetEffectsMasterVolume(uint8 volume);
void SetMusicMasterVolume(uint8 volume);
void SetEffectsFadeVol(uint8 volume);
void SetMusicFadeVol(uint8 volume);
void SetSpeakerConfig(uint32 config);
bool GetChannelUsedFlag(int32 id);
void StopChannel(int32 id);
static bool IsMP3RadioChannelAvailable(); static bool IsMP3RadioChannelAvailable();
}; };
extern uint32 &nNumOfMp3Files;
extern uint8 &num3DProvidersAvailable;
extern uint32* asName3DProviders;
extern CSampleManager &cSampleManager; extern CSampleManager &cSampleManager;

View File

@ -32,6 +32,81 @@ enum eCarLock {
CARLOCK_SKIP_SHUT_DOORS CARLOCK_SKIP_SHUT_DOORS
}; };
// TODO: where is this used? Is Vehicle.h the right file?
enum eVehicleModel
{
LANDSTAL,
IDAHO,
STINGER,
LINERUN,
PEREN,
SENTINEL,
PATRIOT,
FIRETRUK,
TRASH,
STRETCH,
MANANA,
INFERNUS,
BLISTA,
PONY,
MULE,
CHEETAH,
AMBULAN,
FBICAR,
MOONBEAM,
ESPERANT,
TAXI,
KURUMA,
BOBCAT,
MRWHOOP,
BFINJECT,
CORPSE,
POLICE,
ENFORCER,
SECURICA,
BANSHEE,
PREDATOR,
BUS,
RHINO,
BARRACKS,
TRAIN,
CHOPPER,
DODO,
COACH,
CABBIE,
STALLION,
RUMPO,
RCBANDIT,
BELLYUP,
MRWONGS,
MAFIA,
YARDIE,
YAKUZA,
DIABLOS,
COLUMB,
HOODS,
AIRTRAIN,
DEADDODO,
SPEEDER,
REEFER,
PANLANT,
FLATBED,
YANKEE,
ESCAPE,
BORGNINE,
TOYZ,
GHOST,
CAR151,
CAR152,
CAR153,
CAR154,
CAR155,
CAR156,
CAR157,
CAR158,
CAR159,
};
enum eDoors { enum eDoors {
}; };